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

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

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

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

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

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

    @JsonCreator
    public MediaProvider(
            @JsonProperty("identifier") Optional<String> identifier,
            @JsonProperty("title") Optional<String> title,
            @JsonProperty("types") Optional<String> types,
            @JsonProperty("protocols") Optional<String> protocols,
            @JsonProperty("Feature") Optional<? extends List<Feature>> feature) {
        Utils.checkNotNull(identifier, "identifier");
        Utils.checkNotNull(title, "title");
        Utils.checkNotNull(types, "types");
        Utils.checkNotNull(protocols, "protocols");
        Utils.checkNotNull(feature, "feature");
        this.identifier = identifier;
        this.title = title;
        this.types = types;
        this.protocols = protocols;
        this.feature = feature;
    }
    
    public MediaProvider() {
        this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
    }

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

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

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

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

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

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

    public MediaProvider withIdentifier(String identifier) {
        Utils.checkNotNull(identifier, "identifier");
        this.identifier = Optional.ofNullable(identifier);
        return this;
    }

    public MediaProvider withIdentifier(Optional<String> identifier) {
        Utils.checkNotNull(identifier, "identifier");
        this.identifier = identifier;
        return this;
    }

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

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

    public MediaProvider withTypes(String types) {
        Utils.checkNotNull(types, "types");
        this.types = Optional.ofNullable(types);
        return this;
    }

    public MediaProvider withTypes(Optional<String> types) {
        Utils.checkNotNull(types, "types");
        this.types = types;
        return this;
    }

    public MediaProvider withProtocols(String protocols) {
        Utils.checkNotNull(protocols, "protocols");
        this.protocols = Optional.ofNullable(protocols);
        return this;
    }

    public MediaProvider withProtocols(Optional<String> protocols) {
        Utils.checkNotNull(protocols, "protocols");
        this.protocols = protocols;
        return this;
    }

    public MediaProvider withFeature(List<Feature> feature) {
        Utils.checkNotNull(feature, "feature");
        this.feature = Optional.ofNullable(feature);
        return this;
    }

    public MediaProvider withFeature(Optional<? extends List<Feature>> feature) {
        Utils.checkNotNull(feature, "feature");
        this.feature = feature;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        MediaProvider other = (MediaProvider) o;
        return 
            Objects.deepEquals(this.identifier, other.identifier) &&
            Objects.deepEquals(this.title, other.title) &&
            Objects.deepEquals(this.types, other.types) &&
            Objects.deepEquals(this.protocols, other.protocols) &&
            Objects.deepEquals(this.feature, other.feature);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            identifier,
            title,
            types,
            protocols,
            feature);
    }
    
    @Override
    public String toString() {
        return Utils.toString(MediaProvider.class,
                "identifier", identifier,
                "title", title,
                "types", types,
                "protocols", protocols,
                "feature", feature);
    }
    
    public final static class Builder {
 
        private Optional<String> identifier = Optional.empty();
 
        private Optional<String> title = Optional.empty();
 
        private Optional<String> types = Optional.empty();
 
        private Optional<String> protocols = Optional.empty();
 
        private Optional<? extends List<Feature>> feature = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

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

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

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

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

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

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

        public Builder feature(Optional<? extends List<Feature>> feature) {
            Utils.checkNotNull(feature, "feature");
            this.feature = feature;
            return this;
        }
        
        public MediaProvider build() {
            return new MediaProvider(
                identifier,
                title,
                types,
                protocols,
                feature);
        }
    }
}

