/* 
 * 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 com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;


public class Release {

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("key")
    private Optional<String> key;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("version")
    private Optional<String> version;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("added")
    private Optional<String> added;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("fixed")
    private Optional<String> fixed;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("downloadURL")
    private Optional<String> downloadURL;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("state")
    private Optional<String> state;

    @JsonCreator
    public Release(
            @JsonProperty("key") Optional<String> key,
            @JsonProperty("version") Optional<String> version,
            @JsonProperty("added") Optional<String> added,
            @JsonProperty("fixed") Optional<String> fixed,
            @JsonProperty("downloadURL") Optional<String> downloadURL,
            @JsonProperty("state") Optional<String> state) {
        Utils.checkNotNull(key, "key");
        Utils.checkNotNull(version, "version");
        Utils.checkNotNull(added, "added");
        Utils.checkNotNull(fixed, "fixed");
        Utils.checkNotNull(downloadURL, "downloadURL");
        Utils.checkNotNull(state, "state");
        this.key = key;
        this.version = version;
        this.added = added;
        this.fixed = fixed;
        this.downloadURL = downloadURL;
        this.state = state;
    }
    
    public Release() {
        this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
    }

    @JsonIgnore
    public Optional<String> key() {
        return key;
    }

    @JsonIgnore
    public Optional<String> version() {
        return version;
    }

    @JsonIgnore
    public Optional<String> added() {
        return added;
    }

    @JsonIgnore
    public Optional<String> fixed() {
        return fixed;
    }

    @JsonIgnore
    public Optional<String> downloadURL() {
        return downloadURL;
    }

    @JsonIgnore
    public Optional<String> state() {
        return state;
    }

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

    public Release withKey(String key) {
        Utils.checkNotNull(key, "key");
        this.key = Optional.ofNullable(key);
        return this;
    }

    public Release withKey(Optional<String> key) {
        Utils.checkNotNull(key, "key");
        this.key = key;
        return this;
    }

    public Release withVersion(String version) {
        Utils.checkNotNull(version, "version");
        this.version = Optional.ofNullable(version);
        return this;
    }

    public Release withVersion(Optional<String> version) {
        Utils.checkNotNull(version, "version");
        this.version = version;
        return this;
    }

    public Release withAdded(String added) {
        Utils.checkNotNull(added, "added");
        this.added = Optional.ofNullable(added);
        return this;
    }

    public Release withAdded(Optional<String> added) {
        Utils.checkNotNull(added, "added");
        this.added = added;
        return this;
    }

    public Release withFixed(String fixed) {
        Utils.checkNotNull(fixed, "fixed");
        this.fixed = Optional.ofNullable(fixed);
        return this;
    }

    public Release withFixed(Optional<String> fixed) {
        Utils.checkNotNull(fixed, "fixed");
        this.fixed = fixed;
        return this;
    }

    public Release withDownloadURL(String downloadURL) {
        Utils.checkNotNull(downloadURL, "downloadURL");
        this.downloadURL = Optional.ofNullable(downloadURL);
        return this;
    }

    public Release withDownloadURL(Optional<String> downloadURL) {
        Utils.checkNotNull(downloadURL, "downloadURL");
        this.downloadURL = downloadURL;
        return this;
    }

    public Release withState(String state) {
        Utils.checkNotNull(state, "state");
        this.state = Optional.ofNullable(state);
        return this;
    }

    public Release withState(Optional<String> state) {
        Utils.checkNotNull(state, "state");
        this.state = state;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Release other = (Release) o;
        return 
            Objects.deepEquals(this.key, other.key) &&
            Objects.deepEquals(this.version, other.version) &&
            Objects.deepEquals(this.added, other.added) &&
            Objects.deepEquals(this.fixed, other.fixed) &&
            Objects.deepEquals(this.downloadURL, other.downloadURL) &&
            Objects.deepEquals(this.state, other.state);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            key,
            version,
            added,
            fixed,
            downloadURL,
            state);
    }
    
    @Override
    public String toString() {
        return Utils.toString(Release.class,
                "key", key,
                "version", version,
                "added", added,
                "fixed", fixed,
                "downloadURL", downloadURL,
                "state", state);
    }
    
    public final static class Builder {
 
        private Optional<String> key = Optional.empty();
 
        private Optional<String> version = Optional.empty();
 
        private Optional<String> added = Optional.empty();
 
        private Optional<String> fixed = Optional.empty();
 
        private Optional<String> downloadURL = Optional.empty();
 
        private Optional<String> state = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

        public Builder key(String key) {
            Utils.checkNotNull(key, "key");
            this.key = Optional.ofNullable(key);
            return this;
        }

        public Builder key(Optional<String> key) {
            Utils.checkNotNull(key, "key");
            this.key = key;
            return this;
        }

        public Builder version(String version) {
            Utils.checkNotNull(version, "version");
            this.version = Optional.ofNullable(version);
            return this;
        }

        public Builder version(Optional<String> version) {
            Utils.checkNotNull(version, "version");
            this.version = version;
            return this;
        }

        public Builder added(String added) {
            Utils.checkNotNull(added, "added");
            this.added = Optional.ofNullable(added);
            return this;
        }

        public Builder added(Optional<String> added) {
            Utils.checkNotNull(added, "added");
            this.added = added;
            return this;
        }

        public Builder fixed(String fixed) {
            Utils.checkNotNull(fixed, "fixed");
            this.fixed = Optional.ofNullable(fixed);
            return this;
        }

        public Builder fixed(Optional<String> fixed) {
            Utils.checkNotNull(fixed, "fixed");
            this.fixed = fixed;
            return this;
        }

        public Builder downloadURL(String downloadURL) {
            Utils.checkNotNull(downloadURL, "downloadURL");
            this.downloadURL = Optional.ofNullable(downloadURL);
            return this;
        }

        public Builder downloadURL(Optional<String> downloadURL) {
            Utils.checkNotNull(downloadURL, "downloadURL");
            this.downloadURL = downloadURL;
            return this;
        }

        public Builder state(String state) {
            Utils.checkNotNull(state, "state");
            this.state = Optional.ofNullable(state);
            return this;
        }

        public Builder state(Optional<String> state) {
            Utils.checkNotNull(state, "state");
            this.state = state;
            return this;
        }
        
        public Release build() {
            return new Release(
                key,
                version,
                added,
                fixed,
                downloadURL,
                state);
        }
    }
}

