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


public class GetPinRequest {

    /**
     * Determines the kind of code returned by the API call
     * Strong codes are used for Pin authentication flows
     * Non-Strong codes are used for `Plex.tv/link`
     * 
     */
    @SpeakeasyMetadata("queryParam:style=form,explode=true,name=strong")
    private Optional<Boolean> strong;

    /**
     * An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
     */
    @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Client-Identifier")
    private Optional<String> clientID;

    /**
     * The name of the client application. (Plex Web, Plex Media Server, etc.)
     */
    @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Product")
    private Optional<String> clientName;

    /**
     * A relatively friendly name for the client device
     */
    @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Device")
    private Optional<String> deviceNickname;

    /**
     * The version of the client application.
     */
    @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Version")
    private Optional<String> clientVersion;

    /**
     * The platform of the client application.
     */
    @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Platform")
    private Optional<String> platform;

    @JsonCreator
    public GetPinRequest(
            Optional<Boolean> strong,
            Optional<String> clientID,
            Optional<String> clientName,
            Optional<String> deviceNickname,
            Optional<String> clientVersion,
            Optional<String> platform) {
        Utils.checkNotNull(strong, "strong");
        Utils.checkNotNull(clientID, "clientID");
        Utils.checkNotNull(clientName, "clientName");
        Utils.checkNotNull(deviceNickname, "deviceNickname");
        Utils.checkNotNull(clientVersion, "clientVersion");
        Utils.checkNotNull(platform, "platform");
        this.strong = strong;
        this.clientID = clientID;
        this.clientName = clientName;
        this.deviceNickname = deviceNickname;
        this.clientVersion = clientVersion;
        this.platform = platform;
    }
    
    public GetPinRequest() {
        this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
    }

    /**
     * Determines the kind of code returned by the API call
     * Strong codes are used for Pin authentication flows
     * Non-Strong codes are used for `Plex.tv/link`
     * 
     */
    @JsonIgnore
    public Optional<Boolean> strong() {
        return strong;
    }

    /**
     * An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
     */
    @JsonIgnore
    public Optional<String> clientID() {
        return clientID;
    }

    /**
     * The name of the client application. (Plex Web, Plex Media Server, etc.)
     */
    @JsonIgnore
    public Optional<String> clientName() {
        return clientName;
    }

    /**
     * A relatively friendly name for the client device
     */
    @JsonIgnore
    public Optional<String> deviceNickname() {
        return deviceNickname;
    }

    /**
     * The version of the client application.
     */
    @JsonIgnore
    public Optional<String> clientVersion() {
        return clientVersion;
    }

    /**
     * The platform of the client application.
     */
    @JsonIgnore
    public Optional<String> platform() {
        return platform;
    }

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

    /**
     * Determines the kind of code returned by the API call
     * Strong codes are used for Pin authentication flows
     * Non-Strong codes are used for `Plex.tv/link`
     * 
     */
    public GetPinRequest withStrong(boolean strong) {
        Utils.checkNotNull(strong, "strong");
        this.strong = Optional.ofNullable(strong);
        return this;
    }

    /**
     * Determines the kind of code returned by the API call
     * Strong codes are used for Pin authentication flows
     * Non-Strong codes are used for `Plex.tv/link`
     * 
     */
    public GetPinRequest withStrong(Optional<Boolean> strong) {
        Utils.checkNotNull(strong, "strong");
        this.strong = strong;
        return this;
    }

    /**
     * An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
     */
    public GetPinRequest withClientID(String clientID) {
        Utils.checkNotNull(clientID, "clientID");
        this.clientID = Optional.ofNullable(clientID);
        return this;
    }

    /**
     * An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
     */
    public GetPinRequest withClientID(Optional<String> clientID) {
        Utils.checkNotNull(clientID, "clientID");
        this.clientID = clientID;
        return this;
    }

    /**
     * The name of the client application. (Plex Web, Plex Media Server, etc.)
     */
    public GetPinRequest withClientName(String clientName) {
        Utils.checkNotNull(clientName, "clientName");
        this.clientName = Optional.ofNullable(clientName);
        return this;
    }

    /**
     * The name of the client application. (Plex Web, Plex Media Server, etc.)
     */
    public GetPinRequest withClientName(Optional<String> clientName) {
        Utils.checkNotNull(clientName, "clientName");
        this.clientName = clientName;
        return this;
    }

    /**
     * A relatively friendly name for the client device
     */
    public GetPinRequest withDeviceNickname(String deviceNickname) {
        Utils.checkNotNull(deviceNickname, "deviceNickname");
        this.deviceNickname = Optional.ofNullable(deviceNickname);
        return this;
    }

    /**
     * A relatively friendly name for the client device
     */
    public GetPinRequest withDeviceNickname(Optional<String> deviceNickname) {
        Utils.checkNotNull(deviceNickname, "deviceNickname");
        this.deviceNickname = deviceNickname;
        return this;
    }

    /**
     * The version of the client application.
     */
    public GetPinRequest withClientVersion(String clientVersion) {
        Utils.checkNotNull(clientVersion, "clientVersion");
        this.clientVersion = Optional.ofNullable(clientVersion);
        return this;
    }

    /**
     * The version of the client application.
     */
    public GetPinRequest withClientVersion(Optional<String> clientVersion) {
        Utils.checkNotNull(clientVersion, "clientVersion");
        this.clientVersion = clientVersion;
        return this;
    }

    /**
     * The platform of the client application.
     */
    public GetPinRequest withPlatform(String platform) {
        Utils.checkNotNull(platform, "platform");
        this.platform = Optional.ofNullable(platform);
        return this;
    }

    /**
     * The platform of the client application.
     */
    public GetPinRequest withPlatform(Optional<String> platform) {
        Utils.checkNotNull(platform, "platform");
        this.platform = platform;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        GetPinRequest other = (GetPinRequest) o;
        return 
            Objects.deepEquals(this.strong, other.strong) &&
            Objects.deepEquals(this.clientID, other.clientID) &&
            Objects.deepEquals(this.clientName, other.clientName) &&
            Objects.deepEquals(this.deviceNickname, other.deviceNickname) &&
            Objects.deepEquals(this.clientVersion, other.clientVersion) &&
            Objects.deepEquals(this.platform, other.platform);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            strong,
            clientID,
            clientName,
            deviceNickname,
            clientVersion,
            platform);
    }
    
    @Override
    public String toString() {
        return Utils.toString(GetPinRequest.class,
                "strong", strong,
                "clientID", clientID,
                "clientName", clientName,
                "deviceNickname", deviceNickname,
                "clientVersion", clientVersion,
                "platform", platform);
    }
    
    public final static class Builder {
 
        private Optional<Boolean> strong;
 
        private Optional<String> clientID = Optional.empty();
 
        private Optional<String> clientName = Optional.empty();
 
        private Optional<String> deviceNickname = Optional.empty();
 
        private Optional<String> clientVersion = Optional.empty();
 
        private Optional<String> platform = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

        /**
         * Determines the kind of code returned by the API call
         * Strong codes are used for Pin authentication flows
         * Non-Strong codes are used for `Plex.tv/link`
         * 
         */
        public Builder strong(boolean strong) {
            Utils.checkNotNull(strong, "strong");
            this.strong = Optional.ofNullable(strong);
            return this;
        }

        /**
         * Determines the kind of code returned by the API call
         * Strong codes are used for Pin authentication flows
         * Non-Strong codes are used for `Plex.tv/link`
         * 
         */
        public Builder strong(Optional<Boolean> strong) {
            Utils.checkNotNull(strong, "strong");
            this.strong = strong;
            return this;
        }

        /**
         * An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
         */
        public Builder clientID(String clientID) {
            Utils.checkNotNull(clientID, "clientID");
            this.clientID = Optional.ofNullable(clientID);
            return this;
        }

        /**
         * An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
         */
        public Builder clientID(Optional<String> clientID) {
            Utils.checkNotNull(clientID, "clientID");
            this.clientID = clientID;
            return this;
        }

        /**
         * The name of the client application. (Plex Web, Plex Media Server, etc.)
         */
        public Builder clientName(String clientName) {
            Utils.checkNotNull(clientName, "clientName");
            this.clientName = Optional.ofNullable(clientName);
            return this;
        }

        /**
         * The name of the client application. (Plex Web, Plex Media Server, etc.)
         */
        public Builder clientName(Optional<String> clientName) {
            Utils.checkNotNull(clientName, "clientName");
            this.clientName = clientName;
            return this;
        }

        /**
         * A relatively friendly name for the client device
         */
        public Builder deviceNickname(String deviceNickname) {
            Utils.checkNotNull(deviceNickname, "deviceNickname");
            this.deviceNickname = Optional.ofNullable(deviceNickname);
            return this;
        }

        /**
         * A relatively friendly name for the client device
         */
        public Builder deviceNickname(Optional<String> deviceNickname) {
            Utils.checkNotNull(deviceNickname, "deviceNickname");
            this.deviceNickname = deviceNickname;
            return this;
        }

        /**
         * The version of the client application.
         */
        public Builder clientVersion(String clientVersion) {
            Utils.checkNotNull(clientVersion, "clientVersion");
            this.clientVersion = Optional.ofNullable(clientVersion);
            return this;
        }

        /**
         * The version of the client application.
         */
        public Builder clientVersion(Optional<String> clientVersion) {
            Utils.checkNotNull(clientVersion, "clientVersion");
            this.clientVersion = clientVersion;
            return this;
        }

        /**
         * The platform of the client application.
         */
        public Builder platform(String platform) {
            Utils.checkNotNull(platform, "platform");
            this.platform = Optional.ofNullable(platform);
            return this;
        }

        /**
         * The platform of the client application.
         */
        public Builder platform(Optional<String> platform) {
            Utils.checkNotNull(platform, "platform");
            this.platform = platform;
            return this;
        }
        
        public GetPinRequest build() {
            if (strong == null) {
                strong = _SINGLETON_VALUE_Strong.value();
            }            return new GetPinRequest(
                strong,
                clientID,
                clientName,
                deviceNickname,
                clientVersion,
                platform);
        }

        private static final LazySingletonValue<Optional<Boolean>> _SINGLETON_VALUE_Strong =
                new LazySingletonValue<>(
                        "strong",
                        "false",
                        new TypeReference<Optional<Boolean>>() {});
    }
}

