/* 
 * 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.util.Objects;
import java.util.Optional;


public class ButlerTask {

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

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

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

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

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

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

    @JsonCreator
    public ButlerTask(
            @JsonProperty("name") Optional<String> name,
            @JsonProperty("interval") Optional<Double> interval,
            @JsonProperty("scheduleRandomized") Optional<Boolean> scheduleRandomized,
            @JsonProperty("enabled") Optional<Boolean> enabled,
            @JsonProperty("title") Optional<String> title,
            @JsonProperty("description") Optional<String> description) {
        Utils.checkNotNull(name, "name");
        Utils.checkNotNull(interval, "interval");
        Utils.checkNotNull(scheduleRandomized, "scheduleRandomized");
        Utils.checkNotNull(enabled, "enabled");
        Utils.checkNotNull(title, "title");
        Utils.checkNotNull(description, "description");
        this.name = name;
        this.interval = interval;
        this.scheduleRandomized = scheduleRandomized;
        this.enabled = enabled;
        this.title = title;
        this.description = description;
    }
    
    public ButlerTask() {
        this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
    }

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

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

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

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

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

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

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

    public ButlerTask withName(String name) {
        Utils.checkNotNull(name, "name");
        this.name = Optional.ofNullable(name);
        return this;
    }

    public ButlerTask withName(Optional<String> name) {
        Utils.checkNotNull(name, "name");
        this.name = name;
        return this;
    }

    public ButlerTask withInterval(double interval) {
        Utils.checkNotNull(interval, "interval");
        this.interval = Optional.ofNullable(interval);
        return this;
    }

    public ButlerTask withInterval(Optional<Double> interval) {
        Utils.checkNotNull(interval, "interval");
        this.interval = interval;
        return this;
    }

    public ButlerTask withScheduleRandomized(boolean scheduleRandomized) {
        Utils.checkNotNull(scheduleRandomized, "scheduleRandomized");
        this.scheduleRandomized = Optional.ofNullable(scheduleRandomized);
        return this;
    }

    public ButlerTask withScheduleRandomized(Optional<Boolean> scheduleRandomized) {
        Utils.checkNotNull(scheduleRandomized, "scheduleRandomized");
        this.scheduleRandomized = scheduleRandomized;
        return this;
    }

    public ButlerTask withEnabled(boolean enabled) {
        Utils.checkNotNull(enabled, "enabled");
        this.enabled = Optional.ofNullable(enabled);
        return this;
    }

    public ButlerTask withEnabled(Optional<Boolean> enabled) {
        Utils.checkNotNull(enabled, "enabled");
        this.enabled = enabled;
        return this;
    }

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

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

    public ButlerTask withDescription(String description) {
        Utils.checkNotNull(description, "description");
        this.description = Optional.ofNullable(description);
        return this;
    }

    public ButlerTask withDescription(Optional<String> description) {
        Utils.checkNotNull(description, "description");
        this.description = description;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ButlerTask other = (ButlerTask) o;
        return 
            Objects.deepEquals(this.name, other.name) &&
            Objects.deepEquals(this.interval, other.interval) &&
            Objects.deepEquals(this.scheduleRandomized, other.scheduleRandomized) &&
            Objects.deepEquals(this.enabled, other.enabled) &&
            Objects.deepEquals(this.title, other.title) &&
            Objects.deepEquals(this.description, other.description);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            name,
            interval,
            scheduleRandomized,
            enabled,
            title,
            description);
    }
    
    @Override
    public String toString() {
        return Utils.toString(ButlerTask.class,
                "name", name,
                "interval", interval,
                "scheduleRandomized", scheduleRandomized,
                "enabled", enabled,
                "title", title,
                "description", description);
    }
    
    public final static class Builder {
 
        private Optional<String> name = Optional.empty();
 
        private Optional<Double> interval = Optional.empty();
 
        private Optional<Boolean> scheduleRandomized = Optional.empty();
 
        private Optional<Boolean> enabled = Optional.empty();
 
        private Optional<String> title = Optional.empty();
 
        private Optional<String> description = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

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

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

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

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

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

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

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

        public Builder enabled(Optional<Boolean> enabled) {
            Utils.checkNotNull(enabled, "enabled");
            this.enabled = enabled;
            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 description(String description) {
            Utils.checkNotNull(description, "description");
            this.description = Optional.ofNullable(description);
            return this;
        }

        public Builder description(Optional<String> description) {
            Utils.checkNotNull(description, "description");
            this.description = description;
            return this;
        }
        
        public ButlerTask build() {
            return new ButlerTask(
                name,
                interval,
                scheduleRandomized,
                enabled,
                title,
                description);
        }
    }
}

