/* 
 * 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.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import dev.plexapi.sdk.utils.Utils;
import java.io.InputStream;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.Objects;
import java.util.Optional;

/**
 * GetServerIdentityRequestTimeout - Request Timeout
 */
public class GetServerIdentityRequestTimeout extends RuntimeException {

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

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

    /**
     * Raw HTTP response; suitable for custom response parsing
     */
    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("RawResponse")
    private Optional<? extends HttpResponse<InputStream>> rawResponse;

    @JsonCreator
    public GetServerIdentityRequestTimeout(
            @JsonProperty("code") Optional<Integer> code,
            @JsonProperty("message") Optional<String> message,
            @JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
        Utils.checkNotNull(code, "code");
        Utils.checkNotNull(message, "message");
        Utils.checkNotNull(rawResponse, "rawResponse");
        this.code = code;
        this.message = message;
        this.rawResponse = rawResponse;
    }
    
    public GetServerIdentityRequestTimeout() {
        this(Optional.empty(), Optional.empty(), Optional.empty());
    }

    public Optional<Integer> code(){
        return code;
    }

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

    /**
     * Raw HTTP response; suitable for custom response parsing
     */
    @SuppressWarnings("unchecked")
    public Optional<HttpResponse<InputStream>> rawResponse(){
        return (Optional<HttpResponse<InputStream>>) rawResponse;
    }
    
    public final static Builder builder() {
        return new Builder();
    }

    public GetServerIdentityRequestTimeout withCode(int code) {
        Utils.checkNotNull(code, "code");
        this.code = Optional.ofNullable(code);
        return this;
    }
    
    public GetServerIdentityRequestTimeout withCode(Optional<Integer> code) {
        Utils.checkNotNull(code, "code");
        this.code = code;
        return this;
    }

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

    /**
     * Raw HTTP response; suitable for custom response parsing
     */
    public GetServerIdentityRequestTimeout withRawResponse(HttpResponse<InputStream> rawResponse) {
        Utils.checkNotNull(rawResponse, "rawResponse");
        this.rawResponse = Optional.ofNullable(rawResponse);
        return this;
    }
    
    /**
     * Raw HTTP response; suitable for custom response parsing
     */
    public GetServerIdentityRequestTimeout withRawResponse(Optional<? extends HttpResponse<InputStream>> rawResponse) {
        Utils.checkNotNull(rawResponse, "rawResponse");
        this.rawResponse = rawResponse;
        return this;
    }

    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        GetServerIdentityRequestTimeout other = (GetServerIdentityRequestTimeout) o;
        return
            Objects.deepEquals(this.code, other.code) &&
            Objects.deepEquals(this.message, other.message) &&
            Objects.deepEquals(this.rawResponse, other.rawResponse);
    }

    @Override
    public int hashCode() {
        return java.util.Objects.hash(
            code,
            message,
            rawResponse);
    }

    @Override
    public String toString() {
        return Utils.toString(GetServerIdentityRequestTimeout.class,
                "code", code,
                "message", message,
                "rawResponse", rawResponse);
    }

    public final static class Builder {

        private Optional<Integer> code = Optional.empty();

        private Optional<String> message = Optional.empty();

        private Optional<? extends HttpResponse<InputStream>> rawResponse;

        private Builder() {
          // force use of static builder() method
        }

        public Builder code(int code) {
            Utils.checkNotNull(code, "code");
            this.code = Optional.ofNullable(code);
            return this;
        }
        
        public Builder code(Optional<Integer> 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;
        }

        /**
         * Raw HTTP response; suitable for custom response parsing
         */
        public Builder rawResponse(HttpResponse<InputStream> rawResponse) {
            Utils.checkNotNull(rawResponse, "rawResponse");
            this.rawResponse = Optional.ofNullable(rawResponse);
            return this;
        }
        
        /**
         * Raw HTTP response; suitable for custom response parsing
         */
        public Builder rawResponse(Optional<? extends HttpResponse<InputStream>> rawResponse) {
            Utils.checkNotNull(rawResponse, "rawResponse");
            this.rawResponse = rawResponse;
            return this;
        }

        public GetServerIdentityRequestTimeout build() {
            return new GetServerIdentityRequestTimeout(
                code,
                message,
                rawResponse);
        }
    }
}
