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

    /**
     * The unique identifier for the client application
     * This is used to track the client application and its usage
     * (UUID, serial number, or other number unique per device)
     * 
     */
    @SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Client-Identifier")
    private Optional<String> xPlexClientIdentifier;

    @SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Product")
    private Optional<String> xPlexProduct;

    @JsonCreator
    public GetPinRequest(
            Optional<Boolean> strong,
            Optional<String> xPlexClientIdentifier,
            Optional<String> xPlexProduct) {
        Utils.checkNotNull(strong, "strong");
        Utils.checkNotNull(xPlexClientIdentifier, "xPlexClientIdentifier");
        Utils.checkNotNull(xPlexProduct, "xPlexProduct");
        this.strong = strong;
        this.xPlexClientIdentifier = xPlexClientIdentifier;
        this.xPlexProduct = xPlexProduct;
    }
    
    public GetPinRequest() {
        this(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;
    }

    /**
     * The unique identifier for the client application
     * This is used to track the client application and its usage
     * (UUID, serial number, or other number unique per device)
     * 
     */
    @JsonIgnore
    public Optional<String> xPlexClientIdentifier() {
        return xPlexClientIdentifier;
    }

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

    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;
    }

    /**
     * The unique identifier for the client application
     * This is used to track the client application and its usage
     * (UUID, serial number, or other number unique per device)
     * 
     */
    public GetPinRequest withXPlexClientIdentifier(String xPlexClientIdentifier) {
        Utils.checkNotNull(xPlexClientIdentifier, "xPlexClientIdentifier");
        this.xPlexClientIdentifier = Optional.ofNullable(xPlexClientIdentifier);
        return this;
    }

    /**
     * The unique identifier for the client application
     * This is used to track the client application and its usage
     * (UUID, serial number, or other number unique per device)
     * 
     */
    public GetPinRequest withXPlexClientIdentifier(Optional<String> xPlexClientIdentifier) {
        Utils.checkNotNull(xPlexClientIdentifier, "xPlexClientIdentifier");
        this.xPlexClientIdentifier = xPlexClientIdentifier;
        return this;
    }

    public GetPinRequest withXPlexProduct(String xPlexProduct) {
        Utils.checkNotNull(xPlexProduct, "xPlexProduct");
        this.xPlexProduct = Optional.ofNullable(xPlexProduct);
        return this;
    }

    public GetPinRequest withXPlexProduct(Optional<String> xPlexProduct) {
        Utils.checkNotNull(xPlexProduct, "xPlexProduct");
        this.xPlexProduct = xPlexProduct;
        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.xPlexClientIdentifier, other.xPlexClientIdentifier) &&
            Objects.deepEquals(this.xPlexProduct, other.xPlexProduct);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            strong,
            xPlexClientIdentifier,
            xPlexProduct);
    }
    
    @Override
    public String toString() {
        return Utils.toString(GetPinRequest.class,
                "strong", strong,
                "xPlexClientIdentifier", xPlexClientIdentifier,
                "xPlexProduct", xPlexProduct);
    }
    
    public final static class Builder {
 
        private Optional<Boolean> strong;
 
        private Optional<String> xPlexClientIdentifier = Optional.empty();
 
        private Optional<String> xPlexProduct = 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;
        }

        /**
         * The unique identifier for the client application
         * This is used to track the client application and its usage
         * (UUID, serial number, or other number unique per device)
         * 
         */
        public Builder xPlexClientIdentifier(String xPlexClientIdentifier) {
            Utils.checkNotNull(xPlexClientIdentifier, "xPlexClientIdentifier");
            this.xPlexClientIdentifier = Optional.ofNullable(xPlexClientIdentifier);
            return this;
        }

        /**
         * The unique identifier for the client application
         * This is used to track the client application and its usage
         * (UUID, serial number, or other number unique per device)
         * 
         */
        public Builder xPlexClientIdentifier(Optional<String> xPlexClientIdentifier) {
            Utils.checkNotNull(xPlexClientIdentifier, "xPlexClientIdentifier");
            this.xPlexClientIdentifier = xPlexClientIdentifier;
            return this;
        }

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

        public Builder xPlexProduct(Optional<String> xPlexProduct) {
            Utils.checkNotNull(xPlexProduct, "xPlexProduct");
            this.xPlexProduct = xPlexProduct;
            return this;
        }
        
        public GetPinRequest build() {
            if (strong == null) {
                strong = _SINGLETON_VALUE_Strong.value();
            }            return new GetPinRequest(
                strong,
                xPlexClientIdentifier,
                xPlexProduct);
        }

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

