/* 
 * 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.Long;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;


public class GetTokenByPinIdRequest {

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

    /**
     * The PinID to retrieve an access token for
     */
    @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=pinID")
    private long pinID;

    @JsonCreator
    public GetTokenByPinIdRequest(
            Optional<String> xPlexClientIdentifier,
            long pinID) {
        Utils.checkNotNull(xPlexClientIdentifier, "xPlexClientIdentifier");
        Utils.checkNotNull(pinID, "pinID");
        this.xPlexClientIdentifier = xPlexClientIdentifier;
        this.pinID = pinID;
    }
    
    public GetTokenByPinIdRequest(
            long pinID) {
        this(Optional.empty(), pinID);
    }

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

    /**
     * The PinID to retrieve an access token for
     */
    @JsonIgnore
    public long pinID() {
        return pinID;
    }

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

    /**
     * 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 GetTokenByPinIdRequest 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 GetTokenByPinIdRequest withXPlexClientIdentifier(Optional<String> xPlexClientIdentifier) {
        Utils.checkNotNull(xPlexClientIdentifier, "xPlexClientIdentifier");
        this.xPlexClientIdentifier = xPlexClientIdentifier;
        return this;
    }

    /**
     * The PinID to retrieve an access token for
     */
    public GetTokenByPinIdRequest withPinID(long pinID) {
        Utils.checkNotNull(pinID, "pinID");
        this.pinID = pinID;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        GetTokenByPinIdRequest other = (GetTokenByPinIdRequest) o;
        return 
            Objects.deepEquals(this.xPlexClientIdentifier, other.xPlexClientIdentifier) &&
            Objects.deepEquals(this.pinID, other.pinID);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            xPlexClientIdentifier,
            pinID);
    }
    
    @Override
    public String toString() {
        return Utils.toString(GetTokenByPinIdRequest.class,
                "xPlexClientIdentifier", xPlexClientIdentifier,
                "pinID", pinID);
    }
    
    public final static class Builder {
 
        private Optional<String> xPlexClientIdentifier = Optional.empty();
 
        private Long pinID;  
        
        private Builder() {
          // force use of static builder() method
        }

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

        /**
         * The PinID to retrieve an access token for
         */
        public Builder pinID(long pinID) {
            Utils.checkNotNull(pinID, "pinID");
            this.pinID = pinID;
            return this;
        }
        
        public GetTokenByPinIdRequest build() {
            return new GetTokenByPinIdRequest(
                xPlexClientIdentifier,
                pinID);
        }
    }
}

