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


public class Feature {

    @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("Directory")
    private Optional<? extends List<GetMediaProvidersDirectory>> directory;

    @JsonCreator
    public Feature(
            @JsonProperty("key") Optional<String> key,
            @JsonProperty("type") Optional<String> type,
            @JsonProperty("Directory") Optional<? extends List<GetMediaProvidersDirectory>> directory) {
        Utils.checkNotNull(key, "key");
        Utils.checkNotNull(type, "type");
        Utils.checkNotNull(directory, "directory");
        this.key = key;
        this.type = type;
        this.directory = directory;
    }
    
    public Feature() {
        this(Optional.empty(), Optional.empty(), Optional.empty());
    }

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

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

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

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

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

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

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

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

    public Feature withDirectory(List<GetMediaProvidersDirectory> directory) {
        Utils.checkNotNull(directory, "directory");
        this.directory = Optional.ofNullable(directory);
        return this;
    }

    public Feature withDirectory(Optional<? extends List<GetMediaProvidersDirectory>> directory) {
        Utils.checkNotNull(directory, "directory");
        this.directory = directory;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Feature other = (Feature) o;
        return 
            Objects.deepEquals(this.key, other.key) &&
            Objects.deepEquals(this.type, other.type) &&
            Objects.deepEquals(this.directory, other.directory);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            key,
            type,
            directory);
    }
    
    @Override
    public String toString() {
        return Utils.toString(Feature.class,
                "key", key,
                "type", type,
                "directory", directory);
    }
    
    public final static class Builder {
 
        private Optional<String> key = Optional.empty();
 
        private Optional<String> type = Optional.empty();
 
        private Optional<? extends List<GetMediaProvidersDirectory>> directory = 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 directory(List<GetMediaProvidersDirectory> directory) {
            Utils.checkNotNull(directory, "directory");
            this.directory = Optional.ofNullable(directory);
            return this;
        }

        public Builder directory(Optional<? extends List<GetMediaProvidersDirectory>> directory) {
            Utils.checkNotNull(directory, "directory");
            this.directory = directory;
            return this;
        }
        
        public Feature build() {
            return new Feature(
                key,
                type,
                directory);
        }
    }
}

