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


public class StatisticsMedia {

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("accountID")
    private Optional<Integer> accountID;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("deviceID")
    private Optional<Integer> deviceID;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("timespan")
    private Optional<Integer> timespan;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("at")
    private Optional<Integer> at;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("metadataType")
    private Optional<Integer> metadataType;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("count")
    private Optional<Integer> count;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("duration")
    private Optional<Integer> duration;

    @JsonCreator
    public StatisticsMedia(
            @JsonProperty("accountID") Optional<Integer> accountID,
            @JsonProperty("deviceID") Optional<Integer> deviceID,
            @JsonProperty("timespan") Optional<Integer> timespan,
            @JsonProperty("at") Optional<Integer> at,
            @JsonProperty("metadataType") Optional<Integer> metadataType,
            @JsonProperty("count") Optional<Integer> count,
            @JsonProperty("duration") Optional<Integer> duration) {
        Utils.checkNotNull(accountID, "accountID");
        Utils.checkNotNull(deviceID, "deviceID");
        Utils.checkNotNull(timespan, "timespan");
        Utils.checkNotNull(at, "at");
        Utils.checkNotNull(metadataType, "metadataType");
        Utils.checkNotNull(count, "count");
        Utils.checkNotNull(duration, "duration");
        this.accountID = accountID;
        this.deviceID = deviceID;
        this.timespan = timespan;
        this.at = at;
        this.metadataType = metadataType;
        this.count = count;
        this.duration = duration;
    }
    
    public StatisticsMedia() {
        this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
    }

    @JsonIgnore
    public Optional<Integer> accountID() {
        return accountID;
    }

    @JsonIgnore
    public Optional<Integer> deviceID() {
        return deviceID;
    }

    @JsonIgnore
    public Optional<Integer> timespan() {
        return timespan;
    }

    @JsonIgnore
    public Optional<Integer> at() {
        return at;
    }

    @JsonIgnore
    public Optional<Integer> metadataType() {
        return metadataType;
    }

    @JsonIgnore
    public Optional<Integer> count() {
        return count;
    }

    @JsonIgnore
    public Optional<Integer> duration() {
        return duration;
    }

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

    public StatisticsMedia withAccountID(int accountID) {
        Utils.checkNotNull(accountID, "accountID");
        this.accountID = Optional.ofNullable(accountID);
        return this;
    }

    public StatisticsMedia withAccountID(Optional<Integer> accountID) {
        Utils.checkNotNull(accountID, "accountID");
        this.accountID = accountID;
        return this;
    }

    public StatisticsMedia withDeviceID(int deviceID) {
        Utils.checkNotNull(deviceID, "deviceID");
        this.deviceID = Optional.ofNullable(deviceID);
        return this;
    }

    public StatisticsMedia withDeviceID(Optional<Integer> deviceID) {
        Utils.checkNotNull(deviceID, "deviceID");
        this.deviceID = deviceID;
        return this;
    }

    public StatisticsMedia withTimespan(int timespan) {
        Utils.checkNotNull(timespan, "timespan");
        this.timespan = Optional.ofNullable(timespan);
        return this;
    }

    public StatisticsMedia withTimespan(Optional<Integer> timespan) {
        Utils.checkNotNull(timespan, "timespan");
        this.timespan = timespan;
        return this;
    }

    public StatisticsMedia withAt(int at) {
        Utils.checkNotNull(at, "at");
        this.at = Optional.ofNullable(at);
        return this;
    }

    public StatisticsMedia withAt(Optional<Integer> at) {
        Utils.checkNotNull(at, "at");
        this.at = at;
        return this;
    }

    public StatisticsMedia withMetadataType(int metadataType) {
        Utils.checkNotNull(metadataType, "metadataType");
        this.metadataType = Optional.ofNullable(metadataType);
        return this;
    }

    public StatisticsMedia withMetadataType(Optional<Integer> metadataType) {
        Utils.checkNotNull(metadataType, "metadataType");
        this.metadataType = metadataType;
        return this;
    }

    public StatisticsMedia withCount(int count) {
        Utils.checkNotNull(count, "count");
        this.count = Optional.ofNullable(count);
        return this;
    }

    public StatisticsMedia withCount(Optional<Integer> count) {
        Utils.checkNotNull(count, "count");
        this.count = count;
        return this;
    }

    public StatisticsMedia withDuration(int duration) {
        Utils.checkNotNull(duration, "duration");
        this.duration = Optional.ofNullable(duration);
        return this;
    }

    public StatisticsMedia withDuration(Optional<Integer> duration) {
        Utils.checkNotNull(duration, "duration");
        this.duration = duration;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        StatisticsMedia other = (StatisticsMedia) o;
        return 
            Objects.deepEquals(this.accountID, other.accountID) &&
            Objects.deepEquals(this.deviceID, other.deviceID) &&
            Objects.deepEquals(this.timespan, other.timespan) &&
            Objects.deepEquals(this.at, other.at) &&
            Objects.deepEquals(this.metadataType, other.metadataType) &&
            Objects.deepEquals(this.count, other.count) &&
            Objects.deepEquals(this.duration, other.duration);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            accountID,
            deviceID,
            timespan,
            at,
            metadataType,
            count,
            duration);
    }
    
    @Override
    public String toString() {
        return Utils.toString(StatisticsMedia.class,
                "accountID", accountID,
                "deviceID", deviceID,
                "timespan", timespan,
                "at", at,
                "metadataType", metadataType,
                "count", count,
                "duration", duration);
    }
    
    public final static class Builder {
 
        private Optional<Integer> accountID = Optional.empty();
 
        private Optional<Integer> deviceID = Optional.empty();
 
        private Optional<Integer> timespan = Optional.empty();
 
        private Optional<Integer> at = Optional.empty();
 
        private Optional<Integer> metadataType = Optional.empty();
 
        private Optional<Integer> count = Optional.empty();
 
        private Optional<Integer> duration = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

        public Builder duration(Optional<Integer> duration) {
            Utils.checkNotNull(duration, "duration");
            this.duration = duration;
            return this;
        }
        
        public StatisticsMedia build() {
            return new StatisticsMedia(
                accountID,
                deviceID,
                timespan,
                at,
                metadataType,
                count,
                duration);
        }
    }
}

