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


public class GetRecentlyAddedMediaContainer {

    @JsonProperty("size")
    private double size;

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

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

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

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

    /**
     * The Meta object is only included in the response if the `includeMeta` parameter is set to `1`.
     * 
     */
    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("Meta")
    private Optional<? extends Meta> meta;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("Metadata")
    private Optional<? extends List<GetRecentlyAddedMetadata>> metadata;

    @JsonCreator
    public GetRecentlyAddedMediaContainer(
            @JsonProperty("size") double size,
            @JsonProperty("offset") Optional<Integer> offset,
            @JsonProperty("totalSize") Optional<Integer> totalSize,
            @JsonProperty("identifier") Optional<String> identifier,
            @JsonProperty("allowSync") Optional<Boolean> allowSync,
            @JsonProperty("Meta") Optional<? extends Meta> meta,
            @JsonProperty("Metadata") Optional<? extends List<GetRecentlyAddedMetadata>> metadata) {
        Utils.checkNotNull(size, "size");
        Utils.checkNotNull(offset, "offset");
        Utils.checkNotNull(totalSize, "totalSize");
        Utils.checkNotNull(identifier, "identifier");
        Utils.checkNotNull(allowSync, "allowSync");
        Utils.checkNotNull(meta, "meta");
        Utils.checkNotNull(metadata, "metadata");
        this.size = size;
        this.offset = offset;
        this.totalSize = totalSize;
        this.identifier = identifier;
        this.allowSync = allowSync;
        this.meta = meta;
        this.metadata = metadata;
    }
    
    public GetRecentlyAddedMediaContainer(
            double size) {
        this(size, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
    }

    @JsonIgnore
    public double size() {
        return size;
    }

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

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

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

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

    /**
     * The Meta object is only included in the response if the `includeMeta` parameter is set to `1`.
     * 
     */
    @SuppressWarnings("unchecked")
    @JsonIgnore
    public Optional<Meta> meta() {
        return (Optional<Meta>) meta;
    }

    @SuppressWarnings("unchecked")
    @JsonIgnore
    public Optional<List<GetRecentlyAddedMetadata>> metadata() {
        return (Optional<List<GetRecentlyAddedMetadata>>) metadata;
    }

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

    public GetRecentlyAddedMediaContainer withSize(double size) {
        Utils.checkNotNull(size, "size");
        this.size = size;
        return this;
    }

    public GetRecentlyAddedMediaContainer withOffset(int offset) {
        Utils.checkNotNull(offset, "offset");
        this.offset = Optional.ofNullable(offset);
        return this;
    }

    public GetRecentlyAddedMediaContainer withOffset(Optional<Integer> offset) {
        Utils.checkNotNull(offset, "offset");
        this.offset = offset;
        return this;
    }

    public GetRecentlyAddedMediaContainer withTotalSize(int totalSize) {
        Utils.checkNotNull(totalSize, "totalSize");
        this.totalSize = Optional.ofNullable(totalSize);
        return this;
    }

    public GetRecentlyAddedMediaContainer withTotalSize(Optional<Integer> totalSize) {
        Utils.checkNotNull(totalSize, "totalSize");
        this.totalSize = totalSize;
        return this;
    }

    public GetRecentlyAddedMediaContainer withIdentifier(String identifier) {
        Utils.checkNotNull(identifier, "identifier");
        this.identifier = Optional.ofNullable(identifier);
        return this;
    }

    public GetRecentlyAddedMediaContainer withIdentifier(Optional<String> identifier) {
        Utils.checkNotNull(identifier, "identifier");
        this.identifier = identifier;
        return this;
    }

    public GetRecentlyAddedMediaContainer withAllowSync(boolean allowSync) {
        Utils.checkNotNull(allowSync, "allowSync");
        this.allowSync = Optional.ofNullable(allowSync);
        return this;
    }

    public GetRecentlyAddedMediaContainer withAllowSync(Optional<Boolean> allowSync) {
        Utils.checkNotNull(allowSync, "allowSync");
        this.allowSync = allowSync;
        return this;
    }

    /**
     * The Meta object is only included in the response if the `includeMeta` parameter is set to `1`.
     * 
     */
    public GetRecentlyAddedMediaContainer withMeta(Meta meta) {
        Utils.checkNotNull(meta, "meta");
        this.meta = Optional.ofNullable(meta);
        return this;
    }

    /**
     * The Meta object is only included in the response if the `includeMeta` parameter is set to `1`.
     * 
     */
    public GetRecentlyAddedMediaContainer withMeta(Optional<? extends Meta> meta) {
        Utils.checkNotNull(meta, "meta");
        this.meta = meta;
        return this;
    }

    public GetRecentlyAddedMediaContainer withMetadata(List<GetRecentlyAddedMetadata> metadata) {
        Utils.checkNotNull(metadata, "metadata");
        this.metadata = Optional.ofNullable(metadata);
        return this;
    }

    public GetRecentlyAddedMediaContainer withMetadata(Optional<? extends List<GetRecentlyAddedMetadata>> metadata) {
        Utils.checkNotNull(metadata, "metadata");
        this.metadata = metadata;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        GetRecentlyAddedMediaContainer other = (GetRecentlyAddedMediaContainer) o;
        return 
            Objects.deepEquals(this.size, other.size) &&
            Objects.deepEquals(this.offset, other.offset) &&
            Objects.deepEquals(this.totalSize, other.totalSize) &&
            Objects.deepEquals(this.identifier, other.identifier) &&
            Objects.deepEquals(this.allowSync, other.allowSync) &&
            Objects.deepEquals(this.meta, other.meta) &&
            Objects.deepEquals(this.metadata, other.metadata);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            size,
            offset,
            totalSize,
            identifier,
            allowSync,
            meta,
            metadata);
    }
    
    @Override
    public String toString() {
        return Utils.toString(GetRecentlyAddedMediaContainer.class,
                "size", size,
                "offset", offset,
                "totalSize", totalSize,
                "identifier", identifier,
                "allowSync", allowSync,
                "meta", meta,
                "metadata", metadata);
    }
    
    public final static class Builder {
 
        private Double size;
 
        private Optional<Integer> offset = Optional.empty();
 
        private Optional<Integer> totalSize = Optional.empty();
 
        private Optional<String> identifier = Optional.empty();
 
        private Optional<Boolean> allowSync = Optional.empty();
 
        private Optional<? extends Meta> meta = Optional.empty();
 
        private Optional<? extends List<GetRecentlyAddedMetadata>> metadata = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

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

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

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

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

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

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

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

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

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

        /**
         * The Meta object is only included in the response if the `includeMeta` parameter is set to `1`.
         * 
         */
        public Builder meta(Meta meta) {
            Utils.checkNotNull(meta, "meta");
            this.meta = Optional.ofNullable(meta);
            return this;
        }

        /**
         * The Meta object is only included in the response if the `includeMeta` parameter is set to `1`.
         * 
         */
        public Builder meta(Optional<? extends Meta> meta) {
            Utils.checkNotNull(meta, "meta");
            this.meta = meta;
            return this;
        }

        public Builder metadata(List<GetRecentlyAddedMetadata> metadata) {
            Utils.checkNotNull(metadata, "metadata");
            this.metadata = Optional.ofNullable(metadata);
            return this;
        }

        public Builder metadata(Optional<? extends List<GetRecentlyAddedMetadata>> metadata) {
            Utils.checkNotNull(metadata, "metadata");
            this.metadata = metadata;
            return this;
        }
        
        public GetRecentlyAddedMediaContainer build() {
            return new GetRecentlyAddedMediaContainer(
                size,
                offset,
                totalSize,
                identifier,
                allowSync,
                meta,
                metadata);
        }
    }
}

