/* 
 * 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 dev.plexapi.sdk.utils.SpeakeasyMetadata;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Double;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;


public class CreatePlaylistRequest {

    /**
     * name of the playlist
     */
    @SpeakeasyMetadata("queryParam:style=form,explode=true,name=title")
    private String title;

    /**
     * type of playlist to create
     */
    @SpeakeasyMetadata("queryParam:style=form,explode=true,name=type")
    private CreatePlaylistQueryParamType type;

    /**
     * whether the playlist is smart or not
     */
    @SpeakeasyMetadata("queryParam:style=form,explode=true,name=smart")
    private Smart smart;

    /**
     * the content URI for the playlist
     */
    @SpeakeasyMetadata("queryParam:style=form,explode=true,name=uri")
    private String uri;

    /**
     * the play queue to copy to a playlist
     */
    @SpeakeasyMetadata("queryParam:style=form,explode=true,name=playQueueID")
    private Optional<Double> playQueueID;

    @JsonCreator
    public CreatePlaylistRequest(
            String title,
            CreatePlaylistQueryParamType type,
            Smart smart,
            String uri,
            Optional<Double> playQueueID) {
        Utils.checkNotNull(title, "title");
        Utils.checkNotNull(type, "type");
        Utils.checkNotNull(smart, "smart");
        Utils.checkNotNull(uri, "uri");
        Utils.checkNotNull(playQueueID, "playQueueID");
        this.title = title;
        this.type = type;
        this.smart = smart;
        this.uri = uri;
        this.playQueueID = playQueueID;
    }
    
    public CreatePlaylistRequest(
            String title,
            CreatePlaylistQueryParamType type,
            Smart smart,
            String uri) {
        this(title, type, smart, uri, Optional.empty());
    }

    /**
     * name of the playlist
     */
    @JsonIgnore
    public String title() {
        return title;
    }

    /**
     * type of playlist to create
     */
    @JsonIgnore
    public CreatePlaylistQueryParamType type() {
        return type;
    }

    /**
     * whether the playlist is smart or not
     */
    @JsonIgnore
    public Smart smart() {
        return smart;
    }

    /**
     * the content URI for the playlist
     */
    @JsonIgnore
    public String uri() {
        return uri;
    }

    /**
     * the play queue to copy to a playlist
     */
    @JsonIgnore
    public Optional<Double> playQueueID() {
        return playQueueID;
    }

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

    /**
     * name of the playlist
     */
    public CreatePlaylistRequest withTitle(String title) {
        Utils.checkNotNull(title, "title");
        this.title = title;
        return this;
    }

    /**
     * type of playlist to create
     */
    public CreatePlaylistRequest withType(CreatePlaylistQueryParamType type) {
        Utils.checkNotNull(type, "type");
        this.type = type;
        return this;
    }

    /**
     * whether the playlist is smart or not
     */
    public CreatePlaylistRequest withSmart(Smart smart) {
        Utils.checkNotNull(smart, "smart");
        this.smart = smart;
        return this;
    }

    /**
     * the content URI for the playlist
     */
    public CreatePlaylistRequest withUri(String uri) {
        Utils.checkNotNull(uri, "uri");
        this.uri = uri;
        return this;
    }

    /**
     * the play queue to copy to a playlist
     */
    public CreatePlaylistRequest withPlayQueueID(double playQueueID) {
        Utils.checkNotNull(playQueueID, "playQueueID");
        this.playQueueID = Optional.ofNullable(playQueueID);
        return this;
    }

    /**
     * the play queue to copy to a playlist
     */
    public CreatePlaylistRequest withPlayQueueID(Optional<Double> playQueueID) {
        Utils.checkNotNull(playQueueID, "playQueueID");
        this.playQueueID = playQueueID;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        CreatePlaylistRequest other = (CreatePlaylistRequest) o;
        return 
            Objects.deepEquals(this.title, other.title) &&
            Objects.deepEquals(this.type, other.type) &&
            Objects.deepEquals(this.smart, other.smart) &&
            Objects.deepEquals(this.uri, other.uri) &&
            Objects.deepEquals(this.playQueueID, other.playQueueID);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            title,
            type,
            smart,
            uri,
            playQueueID);
    }
    
    @Override
    public String toString() {
        return Utils.toString(CreatePlaylistRequest.class,
                "title", title,
                "type", type,
                "smart", smart,
                "uri", uri,
                "playQueueID", playQueueID);
    }
    
    public final static class Builder {
 
        private String title;
 
        private CreatePlaylistQueryParamType type;
 
        private Smart smart;
 
        private String uri;
 
        private Optional<Double> playQueueID = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

        /**
         * name of the playlist
         */
        public Builder title(String title) {
            Utils.checkNotNull(title, "title");
            this.title = title;
            return this;
        }

        /**
         * type of playlist to create
         */
        public Builder type(CreatePlaylistQueryParamType type) {
            Utils.checkNotNull(type, "type");
            this.type = type;
            return this;
        }

        /**
         * whether the playlist is smart or not
         */
        public Builder smart(Smart smart) {
            Utils.checkNotNull(smart, "smart");
            this.smart = smart;
            return this;
        }

        /**
         * the content URI for the playlist
         */
        public Builder uri(String uri) {
            Utils.checkNotNull(uri, "uri");
            this.uri = uri;
            return this;
        }

        /**
         * the play queue to copy to a playlist
         */
        public Builder playQueueID(double playQueueID) {
            Utils.checkNotNull(playQueueID, "playQueueID");
            this.playQueueID = Optional.ofNullable(playQueueID);
            return this;
        }

        /**
         * the play queue to copy to a playlist
         */
        public Builder playQueueID(Optional<Double> playQueueID) {
            Utils.checkNotNull(playQueueID, "playQueueID");
            this.playQueueID = playQueueID;
            return this;
        }
        
        public CreatePlaylistRequest build() {
            return new CreatePlaylistRequest(
                title,
                type,
                smart,
                uri,
                playQueueID);
        }
    }
}

