/* 
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

package dev.plexapi.sdk.models.operations;


import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import dev.plexapi.sdk.utils.SpeakeasyMetadata;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.Objects;
import java.util.Optional;


public class CheckForUpdatesRequest {

    /**
     * Indicate that you want to start download any updates found.
     */
    @SpeakeasyMetadata("queryParam:style=form,explode=true,name=download")
    private Optional<? extends Download> download;

    @JsonCreator
    public CheckForUpdatesRequest(
            Optional<? extends Download> download) {
        Utils.checkNotNull(download, "download");
        this.download = download;
    }
    
    public CheckForUpdatesRequest() {
        this(Optional.empty());
    }

    /**
     * Indicate that you want to start download any updates found.
     */
    @SuppressWarnings("unchecked")
    @JsonIgnore
    public Optional<Download> download() {
        return (Optional<Download>) download;
    }

    public final static Builder builder() {
        return new Builder();
    }

    /**
     * Indicate that you want to start download any updates found.
     */
    public CheckForUpdatesRequest withDownload(Download download) {
        Utils.checkNotNull(download, "download");
        this.download = Optional.ofNullable(download);
        return this;
    }

    /**
     * Indicate that you want to start download any updates found.
     */
    public CheckForUpdatesRequest withDownload(Optional<? extends Download> download) {
        Utils.checkNotNull(download, "download");
        this.download = download;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        CheckForUpdatesRequest other = (CheckForUpdatesRequest) o;
        return 
            Objects.deepEquals(this.download, other.download);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            download);
    }
    
    @Override
    public String toString() {
        return Utils.toString(CheckForUpdatesRequest.class,
                "download", download);
    }
    
    public final static class Builder {
 
        private Optional<? extends Download> download = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

        /**
         * Indicate that you want to start download any updates found.
         */
        public Builder download(Download download) {
            Utils.checkNotNull(download, "download");
            this.download = Optional.ofNullable(download);
            return this;
        }

        /**
         * Indicate that you want to start download any updates found.
         */
        public Builder download(Optional<? extends Download> download) {
            Utils.checkNotNull(download, "download");
            this.download = download;
            return this;
        }
        
        public CheckForUpdatesRequest build() {
            return new CheckForUpdatesRequest(
                download);
        }
    }
}

