/* 
 * 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.Boolean;
import java.lang.Double;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.Objects;
import java.util.Optional;


public class Activity {

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

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

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("cancellable")
    private Optional<Boolean> cancellable;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("userID")
    private Optional<Double> userID;

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

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

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("progress")
    private Optional<Double> progress;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("Context")
    private Optional<? extends Context> context;

    @JsonCreator
    public Activity(
            @JsonProperty("uuid") Optional<String> uuid,
            @JsonProperty("type") Optional<String> type,
            @JsonProperty("cancellable") Optional<Boolean> cancellable,
            @JsonProperty("userID") Optional<Double> userID,
            @JsonProperty("title") Optional<String> title,
            @JsonProperty("subtitle") Optional<String> subtitle,
            @JsonProperty("progress") Optional<Double> progress,
            @JsonProperty("Context") Optional<? extends Context> context) {
        Utils.checkNotNull(uuid, "uuid");
        Utils.checkNotNull(type, "type");
        Utils.checkNotNull(cancellable, "cancellable");
        Utils.checkNotNull(userID, "userID");
        Utils.checkNotNull(title, "title");
        Utils.checkNotNull(subtitle, "subtitle");
        Utils.checkNotNull(progress, "progress");
        Utils.checkNotNull(context, "context");
        this.uuid = uuid;
        this.type = type;
        this.cancellable = cancellable;
        this.userID = userID;
        this.title = title;
        this.subtitle = subtitle;
        this.progress = progress;
        this.context = context;
    }
    
    public Activity() {
        this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
    }

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

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

    @JsonIgnore
    public Optional<Boolean> cancellable() {
        return cancellable;
    }

    @JsonIgnore
    public Optional<Double> userID() {
        return userID;
    }

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

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

    @JsonIgnore
    public Optional<Double> progress() {
        return progress;
    }

    @SuppressWarnings("unchecked")
    @JsonIgnore
    public Optional<Context> context() {
        return (Optional<Context>) context;
    }

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

    public Activity withUuid(String uuid) {
        Utils.checkNotNull(uuid, "uuid");
        this.uuid = Optional.ofNullable(uuid);
        return this;
    }

    public Activity withUuid(Optional<String> uuid) {
        Utils.checkNotNull(uuid, "uuid");
        this.uuid = uuid;
        return this;
    }

    public Activity withType(String type) {
        Utils.checkNotNull(type, "type");
        this.type = Optional.ofNullable(type);
        return this;
    }

    public Activity withType(Optional<String> type) {
        Utils.checkNotNull(type, "type");
        this.type = type;
        return this;
    }

    public Activity withCancellable(boolean cancellable) {
        Utils.checkNotNull(cancellable, "cancellable");
        this.cancellable = Optional.ofNullable(cancellable);
        return this;
    }

    public Activity withCancellable(Optional<Boolean> cancellable) {
        Utils.checkNotNull(cancellable, "cancellable");
        this.cancellable = cancellable;
        return this;
    }

    public Activity withUserID(double userID) {
        Utils.checkNotNull(userID, "userID");
        this.userID = Optional.ofNullable(userID);
        return this;
    }

    public Activity withUserID(Optional<Double> userID) {
        Utils.checkNotNull(userID, "userID");
        this.userID = userID;
        return this;
    }

    public Activity withTitle(String title) {
        Utils.checkNotNull(title, "title");
        this.title = Optional.ofNullable(title);
        return this;
    }

    public Activity withTitle(Optional<String> title) {
        Utils.checkNotNull(title, "title");
        this.title = title;
        return this;
    }

    public Activity withSubtitle(String subtitle) {
        Utils.checkNotNull(subtitle, "subtitle");
        this.subtitle = Optional.ofNullable(subtitle);
        return this;
    }

    public Activity withSubtitle(Optional<String> subtitle) {
        Utils.checkNotNull(subtitle, "subtitle");
        this.subtitle = subtitle;
        return this;
    }

    public Activity withProgress(double progress) {
        Utils.checkNotNull(progress, "progress");
        this.progress = Optional.ofNullable(progress);
        return this;
    }

    public Activity withProgress(Optional<Double> progress) {
        Utils.checkNotNull(progress, "progress");
        this.progress = progress;
        return this;
    }

    public Activity withContext(Context context) {
        Utils.checkNotNull(context, "context");
        this.context = Optional.ofNullable(context);
        return this;
    }

    public Activity withContext(Optional<? extends Context> context) {
        Utils.checkNotNull(context, "context");
        this.context = context;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Activity other = (Activity) o;
        return 
            Objects.deepEquals(this.uuid, other.uuid) &&
            Objects.deepEquals(this.type, other.type) &&
            Objects.deepEquals(this.cancellable, other.cancellable) &&
            Objects.deepEquals(this.userID, other.userID) &&
            Objects.deepEquals(this.title, other.title) &&
            Objects.deepEquals(this.subtitle, other.subtitle) &&
            Objects.deepEquals(this.progress, other.progress) &&
            Objects.deepEquals(this.context, other.context);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            uuid,
            type,
            cancellable,
            userID,
            title,
            subtitle,
            progress,
            context);
    }
    
    @Override
    public String toString() {
        return Utils.toString(Activity.class,
                "uuid", uuid,
                "type", type,
                "cancellable", cancellable,
                "userID", userID,
                "title", title,
                "subtitle", subtitle,
                "progress", progress,
                "context", context);
    }
    
    public final static class Builder {
 
        private Optional<String> uuid = Optional.empty();
 
        private Optional<String> type = Optional.empty();
 
        private Optional<Boolean> cancellable = Optional.empty();
 
        private Optional<Double> userID = Optional.empty();
 
        private Optional<String> title = Optional.empty();
 
        private Optional<String> subtitle = Optional.empty();
 
        private Optional<Double> progress = Optional.empty();
 
        private Optional<? extends Context> context = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        public Builder context(Optional<? extends Context> context) {
            Utils.checkNotNull(context, "context");
            this.context = context;
            return this;
        }
        
        public Activity build() {
            return new Activity(
                uuid,
                type,
                cancellable,
                userID,
                title,
                subtitle,
                progress,
                context);
        }
    }
}

