/* 
 * 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 com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.utils.LazySingletonValue;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Boolean;
import java.lang.Long;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.time.OffsetDateTime;
import java.util.Objects;
import java.util.Optional;
import org.openapitools.jackson.nullable.JsonNullable;

/**
 * GetTokenByPinIdAuthPinContainer - The Pin with a non-null authToken when it has been verified by the user
 */

public class GetTokenByPinIdAuthPinContainer {

    @JsonProperty("id")
    private long id;

    @JsonProperty("code")
    private String code;

    @JsonProperty("product")
    private String product;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("trusted")
    private Optional<Boolean> trusted;

    @JsonProperty("qr")
    private String qr;

    /**
     * The X-Client-Identifier used in the request
     */
    @JsonProperty("clientIdentifier")
    private String clientIdentifier;

    /**
     * Geo location data
     */
    @JsonProperty("location")
    private GetTokenByPinIdGeoData location;

    /**
     * The number of seconds this pin expires, by default 900 seconds
     */
    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("expiresIn")
    private Optional<Long> expiresIn;

    @JsonProperty("createdAt")
    private OffsetDateTime createdAt;

    @JsonProperty("expiresAt")
    private OffsetDateTime expiresAt;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("authToken")
    private JsonNullable<String> authToken;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("newRegistration")
    private JsonNullable<? extends Object> newRegistration;

    @JsonCreator
    public GetTokenByPinIdAuthPinContainer(
            @JsonProperty("id") long id,
            @JsonProperty("code") String code,
            @JsonProperty("product") String product,
            @JsonProperty("trusted") Optional<Boolean> trusted,
            @JsonProperty("qr") String qr,
            @JsonProperty("clientIdentifier") String clientIdentifier,
            @JsonProperty("location") GetTokenByPinIdGeoData location,
            @JsonProperty("expiresIn") Optional<Long> expiresIn,
            @JsonProperty("createdAt") OffsetDateTime createdAt,
            @JsonProperty("expiresAt") OffsetDateTime expiresAt,
            @JsonProperty("authToken") JsonNullable<String> authToken,
            @JsonProperty("newRegistration") JsonNullable<? extends Object> newRegistration) {
        Utils.checkNotNull(id, "id");
        Utils.checkNotNull(code, "code");
        Utils.checkNotNull(product, "product");
        Utils.checkNotNull(trusted, "trusted");
        Utils.checkNotNull(qr, "qr");
        Utils.checkNotNull(clientIdentifier, "clientIdentifier");
        Utils.checkNotNull(location, "location");
        Utils.checkNotNull(expiresIn, "expiresIn");
        Utils.checkNotNull(createdAt, "createdAt");
        Utils.checkNotNull(expiresAt, "expiresAt");
        Utils.checkNotNull(authToken, "authToken");
        Utils.checkNotNull(newRegistration, "newRegistration");
        this.id = id;
        this.code = code;
        this.product = product;
        this.trusted = trusted;
        this.qr = qr;
        this.clientIdentifier = clientIdentifier;
        this.location = location;
        this.expiresIn = expiresIn;
        this.createdAt = createdAt;
        this.expiresAt = expiresAt;
        this.authToken = authToken;
        this.newRegistration = newRegistration;
    }
    
    public GetTokenByPinIdAuthPinContainer(
            long id,
            String code,
            String product,
            String qr,
            String clientIdentifier,
            GetTokenByPinIdGeoData location,
            OffsetDateTime createdAt,
            OffsetDateTime expiresAt) {
        this(id, code, product, Optional.empty(), qr, clientIdentifier, location, Optional.empty(), createdAt, expiresAt, JsonNullable.undefined(), JsonNullable.undefined());
    }

    @JsonIgnore
    public long id() {
        return id;
    }

    @JsonIgnore
    public String code() {
        return code;
    }

    @JsonIgnore
    public String product() {
        return product;
    }

    @JsonIgnore
    public Optional<Boolean> trusted() {
        return trusted;
    }

    @JsonIgnore
    public String qr() {
        return qr;
    }

    /**
     * The X-Client-Identifier used in the request
     */
    @JsonIgnore
    public String clientIdentifier() {
        return clientIdentifier;
    }

    /**
     * Geo location data
     */
    @JsonIgnore
    public GetTokenByPinIdGeoData location() {
        return location;
    }

    /**
     * The number of seconds this pin expires, by default 900 seconds
     */
    @JsonIgnore
    public Optional<Long> expiresIn() {
        return expiresIn;
    }

    @JsonIgnore
    public OffsetDateTime createdAt() {
        return createdAt;
    }

    @JsonIgnore
    public OffsetDateTime expiresAt() {
        return expiresAt;
    }

    @JsonIgnore
    public JsonNullable<String> authToken() {
        return authToken;
    }

    @SuppressWarnings("unchecked")
    @JsonIgnore
    public JsonNullable<Object> newRegistration() {
        return (JsonNullable<Object>) newRegistration;
    }

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

    public GetTokenByPinIdAuthPinContainer withId(long id) {
        Utils.checkNotNull(id, "id");
        this.id = id;
        return this;
    }

    public GetTokenByPinIdAuthPinContainer withCode(String code) {
        Utils.checkNotNull(code, "code");
        this.code = code;
        return this;
    }

    public GetTokenByPinIdAuthPinContainer withProduct(String product) {
        Utils.checkNotNull(product, "product");
        this.product = product;
        return this;
    }

    public GetTokenByPinIdAuthPinContainer withTrusted(boolean trusted) {
        Utils.checkNotNull(trusted, "trusted");
        this.trusted = Optional.ofNullable(trusted);
        return this;
    }

    public GetTokenByPinIdAuthPinContainer withTrusted(Optional<Boolean> trusted) {
        Utils.checkNotNull(trusted, "trusted");
        this.trusted = trusted;
        return this;
    }

    public GetTokenByPinIdAuthPinContainer withQr(String qr) {
        Utils.checkNotNull(qr, "qr");
        this.qr = qr;
        return this;
    }

    /**
     * The X-Client-Identifier used in the request
     */
    public GetTokenByPinIdAuthPinContainer withClientIdentifier(String clientIdentifier) {
        Utils.checkNotNull(clientIdentifier, "clientIdentifier");
        this.clientIdentifier = clientIdentifier;
        return this;
    }

    /**
     * Geo location data
     */
    public GetTokenByPinIdAuthPinContainer withLocation(GetTokenByPinIdGeoData location) {
        Utils.checkNotNull(location, "location");
        this.location = location;
        return this;
    }

    /**
     * The number of seconds this pin expires, by default 900 seconds
     */
    public GetTokenByPinIdAuthPinContainer withExpiresIn(long expiresIn) {
        Utils.checkNotNull(expiresIn, "expiresIn");
        this.expiresIn = Optional.ofNullable(expiresIn);
        return this;
    }

    /**
     * The number of seconds this pin expires, by default 900 seconds
     */
    public GetTokenByPinIdAuthPinContainer withExpiresIn(Optional<Long> expiresIn) {
        Utils.checkNotNull(expiresIn, "expiresIn");
        this.expiresIn = expiresIn;
        return this;
    }

    public GetTokenByPinIdAuthPinContainer withCreatedAt(OffsetDateTime createdAt) {
        Utils.checkNotNull(createdAt, "createdAt");
        this.createdAt = createdAt;
        return this;
    }

    public GetTokenByPinIdAuthPinContainer withExpiresAt(OffsetDateTime expiresAt) {
        Utils.checkNotNull(expiresAt, "expiresAt");
        this.expiresAt = expiresAt;
        return this;
    }

    public GetTokenByPinIdAuthPinContainer withAuthToken(String authToken) {
        Utils.checkNotNull(authToken, "authToken");
        this.authToken = JsonNullable.of(authToken);
        return this;
    }

    public GetTokenByPinIdAuthPinContainer withAuthToken(JsonNullable<String> authToken) {
        Utils.checkNotNull(authToken, "authToken");
        this.authToken = authToken;
        return this;
    }

    public GetTokenByPinIdAuthPinContainer withNewRegistration(Object newRegistration) {
        Utils.checkNotNull(newRegistration, "newRegistration");
        this.newRegistration = JsonNullable.of(newRegistration);
        return this;
    }

    public GetTokenByPinIdAuthPinContainer withNewRegistration(JsonNullable<? extends Object> newRegistration) {
        Utils.checkNotNull(newRegistration, "newRegistration");
        this.newRegistration = newRegistration;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        GetTokenByPinIdAuthPinContainer other = (GetTokenByPinIdAuthPinContainer) o;
        return 
            Objects.deepEquals(this.id, other.id) &&
            Objects.deepEquals(this.code, other.code) &&
            Objects.deepEquals(this.product, other.product) &&
            Objects.deepEquals(this.trusted, other.trusted) &&
            Objects.deepEquals(this.qr, other.qr) &&
            Objects.deepEquals(this.clientIdentifier, other.clientIdentifier) &&
            Objects.deepEquals(this.location, other.location) &&
            Objects.deepEquals(this.expiresIn, other.expiresIn) &&
            Objects.deepEquals(this.createdAt, other.createdAt) &&
            Objects.deepEquals(this.expiresAt, other.expiresAt) &&
            Objects.deepEquals(this.authToken, other.authToken) &&
            Objects.deepEquals(this.newRegistration, other.newRegistration);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            id,
            code,
            product,
            trusted,
            qr,
            clientIdentifier,
            location,
            expiresIn,
            createdAt,
            expiresAt,
            authToken,
            newRegistration);
    }
    
    @Override
    public String toString() {
        return Utils.toString(GetTokenByPinIdAuthPinContainer.class,
                "id", id,
                "code", code,
                "product", product,
                "trusted", trusted,
                "qr", qr,
                "clientIdentifier", clientIdentifier,
                "location", location,
                "expiresIn", expiresIn,
                "createdAt", createdAt,
                "expiresAt", expiresAt,
                "authToken", authToken,
                "newRegistration", newRegistration);
    }
    
    public final static class Builder {
 
        private Long id;
 
        private String code;
 
        private String product;
 
        private Optional<Boolean> trusted;
 
        private String qr;
 
        private String clientIdentifier;
 
        private GetTokenByPinIdGeoData location;
 
        private Optional<Long> expiresIn;
 
        private OffsetDateTime createdAt;
 
        private OffsetDateTime expiresAt;
 
        private JsonNullable<String> authToken = JsonNullable.undefined();
 
        private JsonNullable<? extends Object> newRegistration = JsonNullable.undefined();  
        
        private Builder() {
          // force use of static builder() method
        }

        public Builder id(long id) {
            Utils.checkNotNull(id, "id");
            this.id = id;
            return this;
        }

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

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

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

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

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

        /**
         * The X-Client-Identifier used in the request
         */
        public Builder clientIdentifier(String clientIdentifier) {
            Utils.checkNotNull(clientIdentifier, "clientIdentifier");
            this.clientIdentifier = clientIdentifier;
            return this;
        }

        /**
         * Geo location data
         */
        public Builder location(GetTokenByPinIdGeoData location) {
            Utils.checkNotNull(location, "location");
            this.location = location;
            return this;
        }

        /**
         * The number of seconds this pin expires, by default 900 seconds
         */
        public Builder expiresIn(long expiresIn) {
            Utils.checkNotNull(expiresIn, "expiresIn");
            this.expiresIn = Optional.ofNullable(expiresIn);
            return this;
        }

        /**
         * The number of seconds this pin expires, by default 900 seconds
         */
        public Builder expiresIn(Optional<Long> expiresIn) {
            Utils.checkNotNull(expiresIn, "expiresIn");
            this.expiresIn = expiresIn;
            return this;
        }

        public Builder createdAt(OffsetDateTime createdAt) {
            Utils.checkNotNull(createdAt, "createdAt");
            this.createdAt = createdAt;
            return this;
        }

        public Builder expiresAt(OffsetDateTime expiresAt) {
            Utils.checkNotNull(expiresAt, "expiresAt");
            this.expiresAt = expiresAt;
            return this;
        }

        public Builder authToken(String authToken) {
            Utils.checkNotNull(authToken, "authToken");
            this.authToken = JsonNullable.of(authToken);
            return this;
        }

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

        public Builder newRegistration(Object newRegistration) {
            Utils.checkNotNull(newRegistration, "newRegistration");
            this.newRegistration = JsonNullable.of(newRegistration);
            return this;
        }

        public Builder newRegistration(JsonNullable<? extends Object> newRegistration) {
            Utils.checkNotNull(newRegistration, "newRegistration");
            this.newRegistration = newRegistration;
            return this;
        }
        
        public GetTokenByPinIdAuthPinContainer build() {
            if (trusted == null) {
                trusted = _SINGLETON_VALUE_Trusted.value();
            }
            if (expiresIn == null) {
                expiresIn = _SINGLETON_VALUE_ExpiresIn.value();
            }            return new GetTokenByPinIdAuthPinContainer(
                id,
                code,
                product,
                trusted,
                qr,
                clientIdentifier,
                location,
                expiresIn,
                createdAt,
                expiresAt,
                authToken,
                newRegistration);
        }

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

        private static final LazySingletonValue<Optional<Long>> _SINGLETON_VALUE_ExpiresIn =
                new LazySingletonValue<>(
                        "expiresIn",
                        "900",
                        new TypeReference<Optional<Long>>() {});
    }
}

