/* 
 * 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 com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.utils.LazySingletonValue;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Boolean;
import java.lang.Integer;
import java.lang.Long;
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 GetSearchAllLibrariesPart {

    @JsonProperty("id")
    private int id;

    @JsonProperty("key")
    private String key;

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

    @JsonProperty("file")
    private String file;

    @JsonProperty("size")
    private long size;

    /**
     * The container format of the media file.
     * 
     */
    @JsonProperty("container")
    private String container;

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

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

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

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

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

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

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("Stream")
    private Optional<? extends List<GetSearchAllLibrariesStream>> stream;

    @JsonCreator
    public GetSearchAllLibrariesPart(
            @JsonProperty("id") int id,
            @JsonProperty("key") String key,
            @JsonProperty("duration") Optional<Integer> duration,
            @JsonProperty("file") String file,
            @JsonProperty("size") long size,
            @JsonProperty("container") String container,
            @JsonProperty("audioProfile") Optional<String> audioProfile,
            @JsonProperty("has64bitOffsets") Optional<Boolean> has64bitOffsets,
            @JsonProperty("optimizedForStreaming") Optional<Boolean> optimizedForStreaming,
            @JsonProperty("videoProfile") Optional<String> videoProfile,
            @JsonProperty("indexes") Optional<String> indexes,
            @JsonProperty("hasThumbnail") Optional<? extends GetSearchAllLibrariesHasThumbnail> hasThumbnail,
            @JsonProperty("Stream") Optional<? extends List<GetSearchAllLibrariesStream>> stream) {
        Utils.checkNotNull(id, "id");
        Utils.checkNotNull(key, "key");
        Utils.checkNotNull(duration, "duration");
        Utils.checkNotNull(file, "file");
        Utils.checkNotNull(size, "size");
        Utils.checkNotNull(container, "container");
        Utils.checkNotNull(audioProfile, "audioProfile");
        Utils.checkNotNull(has64bitOffsets, "has64bitOffsets");
        Utils.checkNotNull(optimizedForStreaming, "optimizedForStreaming");
        Utils.checkNotNull(videoProfile, "videoProfile");
        Utils.checkNotNull(indexes, "indexes");
        Utils.checkNotNull(hasThumbnail, "hasThumbnail");
        Utils.checkNotNull(stream, "stream");
        this.id = id;
        this.key = key;
        this.duration = duration;
        this.file = file;
        this.size = size;
        this.container = container;
        this.audioProfile = audioProfile;
        this.has64bitOffsets = has64bitOffsets;
        this.optimizedForStreaming = optimizedForStreaming;
        this.videoProfile = videoProfile;
        this.indexes = indexes;
        this.hasThumbnail = hasThumbnail;
        this.stream = stream;
    }
    
    public GetSearchAllLibrariesPart(
            int id,
            String key,
            String file,
            long size,
            String container) {
        this(id, key, Optional.empty(), file, size, container, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
    }

    @JsonIgnore
    public int id() {
        return id;
    }

    @JsonIgnore
    public String key() {
        return key;
    }

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

    @JsonIgnore
    public String file() {
        return file;
    }

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

    /**
     * The container format of the media file.
     * 
     */
    @JsonIgnore
    public String container() {
        return container;
    }

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

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

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

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

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

    @SuppressWarnings("unchecked")
    @JsonIgnore
    public Optional<GetSearchAllLibrariesHasThumbnail> hasThumbnail() {
        return (Optional<GetSearchAllLibrariesHasThumbnail>) hasThumbnail;
    }

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

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

    public GetSearchAllLibrariesPart withId(int id) {
        Utils.checkNotNull(id, "id");
        this.id = id;
        return this;
    }

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

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

    public GetSearchAllLibrariesPart withDuration(Optional<Integer> duration) {
        Utils.checkNotNull(duration, "duration");
        this.duration = duration;
        return this;
    }

    public GetSearchAllLibrariesPart withFile(String file) {
        Utils.checkNotNull(file, "file");
        this.file = file;
        return this;
    }

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

    /**
     * The container format of the media file.
     * 
     */
    public GetSearchAllLibrariesPart withContainer(String container) {
        Utils.checkNotNull(container, "container");
        this.container = container;
        return this;
    }

    public GetSearchAllLibrariesPart withAudioProfile(String audioProfile) {
        Utils.checkNotNull(audioProfile, "audioProfile");
        this.audioProfile = Optional.ofNullable(audioProfile);
        return this;
    }

    public GetSearchAllLibrariesPart withAudioProfile(Optional<String> audioProfile) {
        Utils.checkNotNull(audioProfile, "audioProfile");
        this.audioProfile = audioProfile;
        return this;
    }

    public GetSearchAllLibrariesPart withHas64bitOffsets(boolean has64bitOffsets) {
        Utils.checkNotNull(has64bitOffsets, "has64bitOffsets");
        this.has64bitOffsets = Optional.ofNullable(has64bitOffsets);
        return this;
    }

    public GetSearchAllLibrariesPart withHas64bitOffsets(Optional<Boolean> has64bitOffsets) {
        Utils.checkNotNull(has64bitOffsets, "has64bitOffsets");
        this.has64bitOffsets = has64bitOffsets;
        return this;
    }

    public GetSearchAllLibrariesPart withOptimizedForStreaming(boolean optimizedForStreaming) {
        Utils.checkNotNull(optimizedForStreaming, "optimizedForStreaming");
        this.optimizedForStreaming = Optional.ofNullable(optimizedForStreaming);
        return this;
    }

    public GetSearchAllLibrariesPart withOptimizedForStreaming(Optional<Boolean> optimizedForStreaming) {
        Utils.checkNotNull(optimizedForStreaming, "optimizedForStreaming");
        this.optimizedForStreaming = optimizedForStreaming;
        return this;
    }

    public GetSearchAllLibrariesPart withVideoProfile(String videoProfile) {
        Utils.checkNotNull(videoProfile, "videoProfile");
        this.videoProfile = Optional.ofNullable(videoProfile);
        return this;
    }

    public GetSearchAllLibrariesPart withVideoProfile(Optional<String> videoProfile) {
        Utils.checkNotNull(videoProfile, "videoProfile");
        this.videoProfile = videoProfile;
        return this;
    }

    public GetSearchAllLibrariesPart withIndexes(String indexes) {
        Utils.checkNotNull(indexes, "indexes");
        this.indexes = Optional.ofNullable(indexes);
        return this;
    }

    public GetSearchAllLibrariesPart withIndexes(Optional<String> indexes) {
        Utils.checkNotNull(indexes, "indexes");
        this.indexes = indexes;
        return this;
    }

    public GetSearchAllLibrariesPart withHasThumbnail(GetSearchAllLibrariesHasThumbnail hasThumbnail) {
        Utils.checkNotNull(hasThumbnail, "hasThumbnail");
        this.hasThumbnail = Optional.ofNullable(hasThumbnail);
        return this;
    }

    public GetSearchAllLibrariesPart withHasThumbnail(Optional<? extends GetSearchAllLibrariesHasThumbnail> hasThumbnail) {
        Utils.checkNotNull(hasThumbnail, "hasThumbnail");
        this.hasThumbnail = hasThumbnail;
        return this;
    }

    public GetSearchAllLibrariesPart withStream(List<GetSearchAllLibrariesStream> stream) {
        Utils.checkNotNull(stream, "stream");
        this.stream = Optional.ofNullable(stream);
        return this;
    }

    public GetSearchAllLibrariesPart withStream(Optional<? extends List<GetSearchAllLibrariesStream>> stream) {
        Utils.checkNotNull(stream, "stream");
        this.stream = stream;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        GetSearchAllLibrariesPart other = (GetSearchAllLibrariesPart) o;
        return 
            Objects.deepEquals(this.id, other.id) &&
            Objects.deepEquals(this.key, other.key) &&
            Objects.deepEquals(this.duration, other.duration) &&
            Objects.deepEquals(this.file, other.file) &&
            Objects.deepEquals(this.size, other.size) &&
            Objects.deepEquals(this.container, other.container) &&
            Objects.deepEquals(this.audioProfile, other.audioProfile) &&
            Objects.deepEquals(this.has64bitOffsets, other.has64bitOffsets) &&
            Objects.deepEquals(this.optimizedForStreaming, other.optimizedForStreaming) &&
            Objects.deepEquals(this.videoProfile, other.videoProfile) &&
            Objects.deepEquals(this.indexes, other.indexes) &&
            Objects.deepEquals(this.hasThumbnail, other.hasThumbnail) &&
            Objects.deepEquals(this.stream, other.stream);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            id,
            key,
            duration,
            file,
            size,
            container,
            audioProfile,
            has64bitOffsets,
            optimizedForStreaming,
            videoProfile,
            indexes,
            hasThumbnail,
            stream);
    }
    
    @Override
    public String toString() {
        return Utils.toString(GetSearchAllLibrariesPart.class,
                "id", id,
                "key", key,
                "duration", duration,
                "file", file,
                "size", size,
                "container", container,
                "audioProfile", audioProfile,
                "has64bitOffsets", has64bitOffsets,
                "optimizedForStreaming", optimizedForStreaming,
                "videoProfile", videoProfile,
                "indexes", indexes,
                "hasThumbnail", hasThumbnail,
                "stream", stream);
    }
    
    public final static class Builder {
 
        private Integer id;
 
        private String key;
 
        private Optional<Integer> duration = Optional.empty();
 
        private String file;
 
        private Long size;
 
        private String container;
 
        private Optional<String> audioProfile = Optional.empty();
 
        private Optional<Boolean> has64bitOffsets = Optional.empty();
 
        private Optional<Boolean> optimizedForStreaming = Optional.empty();
 
        private Optional<String> videoProfile = Optional.empty();
 
        private Optional<String> indexes = Optional.empty();
 
        private Optional<? extends GetSearchAllLibrariesHasThumbnail> hasThumbnail;
 
        private Optional<? extends List<GetSearchAllLibrariesStream>> stream = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

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

        public Builder key(String key) {
            Utils.checkNotNull(key, "key");
            this.key = key;
            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 Builder file(String file) {
            Utils.checkNotNull(file, "file");
            this.file = file;
            return this;
        }

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

        /**
         * The container format of the media file.
         * 
         */
        public Builder container(String container) {
            Utils.checkNotNull(container, "container");
            this.container = container;
            return this;
        }

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

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

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

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

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

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

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

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

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

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

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

        public Builder hasThumbnail(Optional<? extends GetSearchAllLibrariesHasThumbnail> hasThumbnail) {
            Utils.checkNotNull(hasThumbnail, "hasThumbnail");
            this.hasThumbnail = hasThumbnail;
            return this;
        }

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

        public Builder stream(Optional<? extends List<GetSearchAllLibrariesStream>> stream) {
            Utils.checkNotNull(stream, "stream");
            this.stream = stream;
            return this;
        }
        
        public GetSearchAllLibrariesPart build() {
            if (hasThumbnail == null) {
                hasThumbnail = _SINGLETON_VALUE_HasThumbnail.value();
            }            return new GetSearchAllLibrariesPart(
                id,
                key,
                duration,
                file,
                size,
                container,
                audioProfile,
                has64bitOffsets,
                optimizedForStreaming,
                videoProfile,
                indexes,
                hasThumbnail,
                stream);
        }

        private static final LazySingletonValue<Optional<? extends GetSearchAllLibrariesHasThumbnail>> _SINGLETON_VALUE_HasThumbnail =
                new LazySingletonValue<>(
                        "hasThumbnail",
                        "\"0\"",
                        new TypeReference<Optional<? extends GetSearchAllLibrariesHasThumbnail>>() {});
    }
}

