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


public class GetLibraryDetailsType {

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

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

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

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

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("Filter")
    private Optional<? extends List<GetLibraryDetailsFilter>> filter;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("Sort")
    private Optional<? extends List<GetLibraryDetailsSort>> sort;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("Field")
    private Optional<? extends List<GetLibraryDetailsField>> field;

    @JsonCreator
    public GetLibraryDetailsType(
            @JsonProperty("key") Optional<String> key,
            @JsonProperty("type") Optional<String> type,
            @JsonProperty("title") Optional<String> title,
            @JsonProperty("active") Optional<Boolean> active,
            @JsonProperty("Filter") Optional<? extends List<GetLibraryDetailsFilter>> filter,
            @JsonProperty("Sort") Optional<? extends List<GetLibraryDetailsSort>> sort,
            @JsonProperty("Field") Optional<? extends List<GetLibraryDetailsField>> field) {
        Utils.checkNotNull(key, "key");
        Utils.checkNotNull(type, "type");
        Utils.checkNotNull(title, "title");
        Utils.checkNotNull(active, "active");
        Utils.checkNotNull(filter, "filter");
        Utils.checkNotNull(sort, "sort");
        Utils.checkNotNull(field, "field");
        this.key = key;
        this.type = type;
        this.title = title;
        this.active = active;
        this.filter = filter;
        this.sort = sort;
        this.field = field;
    }
    
    public GetLibraryDetailsType() {
        this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
    }

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

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

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

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

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

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

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

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

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

    public GetLibraryDetailsType withKey(Optional<String> key) {
        Utils.checkNotNull(key, "key");
        this.key = key;
        return this;
    }

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

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

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

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

    public GetLibraryDetailsType withActive(boolean active) {
        Utils.checkNotNull(active, "active");
        this.active = Optional.ofNullable(active);
        return this;
    }

    public GetLibraryDetailsType withActive(Optional<Boolean> active) {
        Utils.checkNotNull(active, "active");
        this.active = active;
        return this;
    }

    public GetLibraryDetailsType withFilter(List<GetLibraryDetailsFilter> filter) {
        Utils.checkNotNull(filter, "filter");
        this.filter = Optional.ofNullable(filter);
        return this;
    }

    public GetLibraryDetailsType withFilter(Optional<? extends List<GetLibraryDetailsFilter>> filter) {
        Utils.checkNotNull(filter, "filter");
        this.filter = filter;
        return this;
    }

    public GetLibraryDetailsType withSort(List<GetLibraryDetailsSort> sort) {
        Utils.checkNotNull(sort, "sort");
        this.sort = Optional.ofNullable(sort);
        return this;
    }

    public GetLibraryDetailsType withSort(Optional<? extends List<GetLibraryDetailsSort>> sort) {
        Utils.checkNotNull(sort, "sort");
        this.sort = sort;
        return this;
    }

    public GetLibraryDetailsType withField(List<GetLibraryDetailsField> field) {
        Utils.checkNotNull(field, "field");
        this.field = Optional.ofNullable(field);
        return this;
    }

    public GetLibraryDetailsType withField(Optional<? extends List<GetLibraryDetailsField>> field) {
        Utils.checkNotNull(field, "field");
        this.field = field;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        GetLibraryDetailsType other = (GetLibraryDetailsType) o;
        return 
            Objects.deepEquals(this.key, other.key) &&
            Objects.deepEquals(this.type, other.type) &&
            Objects.deepEquals(this.title, other.title) &&
            Objects.deepEquals(this.active, other.active) &&
            Objects.deepEquals(this.filter, other.filter) &&
            Objects.deepEquals(this.sort, other.sort) &&
            Objects.deepEquals(this.field, other.field);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            key,
            type,
            title,
            active,
            filter,
            sort,
            field);
    }
    
    @Override
    public String toString() {
        return Utils.toString(GetLibraryDetailsType.class,
                "key", key,
                "type", type,
                "title", title,
                "active", active,
                "filter", filter,
                "sort", sort,
                "field", field);
    }
    
    public final static class Builder {
 
        private Optional<String> key = Optional.empty();
 
        private Optional<String> type = Optional.empty();
 
        private Optional<String> title = Optional.empty();
 
        private Optional<Boolean> active = Optional.empty();
 
        private Optional<? extends List<GetLibraryDetailsFilter>> filter = Optional.empty();
 
        private Optional<? extends List<GetLibraryDetailsSort>> sort = Optional.empty();
 
        private Optional<? extends List<GetLibraryDetailsField>> field = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

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

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

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

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

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

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

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

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

        public Builder field(Optional<? extends List<GetLibraryDetailsField>> field) {
            Utils.checkNotNull(field, "field");
            this.field = field;
            return this;
        }
        
        public GetLibraryDetailsType build() {
            return new GetLibraryDetailsType(
                key,
                type,
                title,
                active,
                filter,
                sort,
                field);
        }
    }
}

