/* 
 * 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;

    @JsonProperty("type")
    private String type;

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

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

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

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("Directory")
    private Optional<? extends List<GetMediaProvidersDirectory>> directory;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("Action")
    private Optional<? extends List<Action>> action;

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

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

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

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

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

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

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

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

    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 = type;
        return this;
    }

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

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

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

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

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

    public Feature withUnscrobbleKey(Optional<String> unscrobbleKey) {
        Utils.checkNotNull(unscrobbleKey, "unscrobbleKey");
        this.unscrobbleKey = unscrobbleKey;
        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;
    }

    public Feature withAction(List<Action> action) {
        Utils.checkNotNull(action, "action");
        this.action = Optional.ofNullable(action);
        return this;
    }

    public Feature withAction(Optional<? extends List<Action>> action) {
        Utils.checkNotNull(action, "action");
        this.action = action;
        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.flavor, other.flavor) &&
            Objects.deepEquals(this.scrobbleKey, other.scrobbleKey) &&
            Objects.deepEquals(this.unscrobbleKey, other.unscrobbleKey) &&
            Objects.deepEquals(this.directory, other.directory) &&
            Objects.deepEquals(this.action, other.action);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            key,
            type,
            flavor,
            scrobbleKey,
            unscrobbleKey,
            directory,
            action);
    }
    
    @Override
    public String toString() {
        return Utils.toString(Feature.class,
                "key", key,
                "type", type,
                "flavor", flavor,
                "scrobbleKey", scrobbleKey,
                "unscrobbleKey", unscrobbleKey,
                "directory", directory,
                "action", action);
    }
    
    public final static class Builder {
 
        private Optional<String> key = Optional.empty();
 
        private String type;
 
        private Optional<String> flavor = Optional.empty();
 
        private Optional<String> scrobbleKey = Optional.empty();
 
        private Optional<String> unscrobbleKey = Optional.empty();
 
        private Optional<? extends List<GetMediaProvidersDirectory>> directory = Optional.empty();
 
        private Optional<? extends List<Action>> action = 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 = type;
            return this;
        }

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

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

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

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

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

        public Builder unscrobbleKey(Optional<String> unscrobbleKey) {
            Utils.checkNotNull(unscrobbleKey, "unscrobbleKey");
            this.unscrobbleKey = unscrobbleKey;
            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 Builder action(List<Action> action) {
            Utils.checkNotNull(action, "action");
            this.action = Optional.ofNullable(action);
            return this;
        }

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

