/* 
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

package dev.plexapi.sdk.models.errors;


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 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 GetTokenByPinIdPlexErrors {

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("code")
    private Optional<Long> code;

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("message")
    private Optional<String> message;

    @JsonCreator
    public GetTokenByPinIdPlexErrors(
            @JsonProperty("code") Optional<Long> code,
            @JsonProperty("message") Optional<String> message) {
        Utils.checkNotNull(code, "code");
        Utils.checkNotNull(message, "message");
        this.code = code;
        this.message = message;
    }
    
    public GetTokenByPinIdPlexErrors() {
        this(Optional.empty(), Optional.empty());
    }

    @JsonIgnore
    public Optional<Long> code() {
        return code;
    }

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

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

    public GetTokenByPinIdPlexErrors withCode(long code) {
        Utils.checkNotNull(code, "code");
        this.code = Optional.ofNullable(code);
        return this;
    }

    public GetTokenByPinIdPlexErrors withCode(Optional<Long> code) {
        Utils.checkNotNull(code, "code");
        this.code = code;
        return this;
    }

    public GetTokenByPinIdPlexErrors withMessage(String message) {
        Utils.checkNotNull(message, "message");
        this.message = Optional.ofNullable(message);
        return this;
    }

    public GetTokenByPinIdPlexErrors withMessage(Optional<String> message) {
        Utils.checkNotNull(message, "message");
        this.message = message;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        GetTokenByPinIdPlexErrors other = (GetTokenByPinIdPlexErrors) o;
        return 
            Objects.deepEquals(this.code, other.code) &&
            Objects.deepEquals(this.message, other.message);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            code,
            message);
    }
    
    @Override
    public String toString() {
        return Utils.toString(GetTokenByPinIdPlexErrors.class,
                "code", code,
                "message", message);
    }
    
    public final static class Builder {
 
        private Optional<Long> code = Optional.empty();
 
        private Optional<String> message = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

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

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

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

        public Builder message(Optional<String> message) {
            Utils.checkNotNull(message, "message");
            this.message = message;
            return this;
        }
        
        public GetTokenByPinIdPlexErrors build() {
            return new GetTokenByPinIdPlexErrors(
                code,
                message);
        }
    }
}

