/* 
 * 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 GetLibraryItemsLibraryResponseType {

    @JsonProperty("key")
    private String key;

    @JsonProperty("type")
    private String type;

    @JsonProperty("title")
    private String title;

    @JsonProperty("active")
    private boolean active;

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

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

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

    @JsonCreator
    public GetLibraryItemsLibraryResponseType(
            @JsonProperty("key") String key,
            @JsonProperty("type") String type,
            @JsonProperty("title") String title,
            @JsonProperty("active") boolean active,
            @JsonProperty("Filter") Optional<? extends List<GetLibraryItemsLibraryFilter>> filter,
            @JsonProperty("Sort") Optional<? extends List<GetLibraryItemsLibrarySort>> sort,
            @JsonProperty("Field") Optional<? extends List<GetLibraryItemsLibraryField>> 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 GetLibraryItemsLibraryResponseType(
            String key,
            String type,
            String title,
            boolean active) {
        this(key, type, title, active, Optional.empty(), Optional.empty(), Optional.empty());
    }

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

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

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

    @JsonIgnore
    public boolean active() {
        return active;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

    public GetLibraryItemsLibraryResponseType withField(Optional<? extends List<GetLibraryItemsLibraryField>> 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;
        }
        GetLibraryItemsLibraryResponseType other = (GetLibraryItemsLibraryResponseType) 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(GetLibraryItemsLibraryResponseType.class,
                "key", key,
                "type", type,
                "title", title,
                "active", active,
                "filter", filter,
                "sort", sort,
                "field", field);
    }
    
    public final static class Builder {
 
        private String key;
 
        private String type;
 
        private String title;
 
        private Boolean active;
 
        private Optional<? extends List<GetLibraryItemsLibraryFilter>> filter = Optional.empty();
 
        private Optional<? extends List<GetLibraryItemsLibrarySort>> sort = Optional.empty();
 
        private Optional<? extends List<GetLibraryItemsLibraryField>> field = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

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

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

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

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

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

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

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

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

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

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

