/* 
 * 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.Response;
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.List;
import java.util.Objects;
import java.util.Optional;


public class GetServerResourcesResponse implements Response {

    /**
     * HTTP response content type for this operation
     */
    private String contentType;

    /**
     * HTTP response status code for this operation
     */
    private int statusCode;

    /**
     * Raw HTTP response; suitable for custom response parsing
     */
    private HttpResponse<InputStream> rawResponse;

    /**
     * List of Plex Devices. This includes Plex hosted servers and clients
     */
    private Optional<? extends List<PlexDevice>> plexDevices;

    @JsonCreator
    public GetServerResourcesResponse(
            String contentType,
            int statusCode,
            HttpResponse<InputStream> rawResponse,
            Optional<? extends List<PlexDevice>> plexDevices) {
        Utils.checkNotNull(contentType, "contentType");
        Utils.checkNotNull(statusCode, "statusCode");
        Utils.checkNotNull(rawResponse, "rawResponse");
        Utils.checkNotNull(plexDevices, "plexDevices");
        this.contentType = contentType;
        this.statusCode = statusCode;
        this.rawResponse = rawResponse;
        this.plexDevices = plexDevices;
    }
    
    public GetServerResourcesResponse(
            String contentType,
            int statusCode,
            HttpResponse<InputStream> rawResponse) {
        this(contentType, statusCode, rawResponse, Optional.empty());
    }

    /**
     * HTTP response content type for this operation
     */
    @JsonIgnore
    public String contentType() {
        return contentType;
    }

    /**
     * HTTP response status code for this operation
     */
    @JsonIgnore
    public int statusCode() {
        return statusCode;
    }

    /**
     * Raw HTTP response; suitable for custom response parsing
     */
    @JsonIgnore
    public HttpResponse<InputStream> rawResponse() {
        return rawResponse;
    }

    /**
     * List of Plex Devices. This includes Plex hosted servers and clients
     */
    @SuppressWarnings("unchecked")
    @JsonIgnore
    public Optional<List<PlexDevice>> plexDevices() {
        return (Optional<List<PlexDevice>>) plexDevices;
    }

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

    /**
     * HTTP response content type for this operation
     */
    public GetServerResourcesResponse withContentType(String contentType) {
        Utils.checkNotNull(contentType, "contentType");
        this.contentType = contentType;
        return this;
    }

    /**
     * HTTP response status code for this operation
     */
    public GetServerResourcesResponse withStatusCode(int statusCode) {
        Utils.checkNotNull(statusCode, "statusCode");
        this.statusCode = statusCode;
        return this;
    }

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

    /**
     * List of Plex Devices. This includes Plex hosted servers and clients
     */
    public GetServerResourcesResponse withPlexDevices(List<PlexDevice> plexDevices) {
        Utils.checkNotNull(plexDevices, "plexDevices");
        this.plexDevices = Optional.ofNullable(plexDevices);
        return this;
    }

    /**
     * List of Plex Devices. This includes Plex hosted servers and clients
     */
    public GetServerResourcesResponse withPlexDevices(Optional<? extends List<PlexDevice>> plexDevices) {
        Utils.checkNotNull(plexDevices, "plexDevices");
        this.plexDevices = plexDevices;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        GetServerResourcesResponse other = (GetServerResourcesResponse) o;
        return 
            Objects.deepEquals(this.contentType, other.contentType) &&
            Objects.deepEquals(this.statusCode, other.statusCode) &&
            Objects.deepEquals(this.rawResponse, other.rawResponse) &&
            Objects.deepEquals(this.plexDevices, other.plexDevices);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            contentType,
            statusCode,
            rawResponse,
            plexDevices);
    }
    
    @Override
    public String toString() {
        return Utils.toString(GetServerResourcesResponse.class,
                "contentType", contentType,
                "statusCode", statusCode,
                "rawResponse", rawResponse,
                "plexDevices", plexDevices);
    }
    
    public final static class Builder {
 
        private String contentType;
 
        private Integer statusCode;
 
        private HttpResponse<InputStream> rawResponse;
 
        private Optional<? extends List<PlexDevice>> plexDevices = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

        /**
         * HTTP response content type for this operation
         */
        public Builder contentType(String contentType) {
            Utils.checkNotNull(contentType, "contentType");
            this.contentType = contentType;
            return this;
        }

        /**
         * HTTP response status code for this operation
         */
        public Builder statusCode(int statusCode) {
            Utils.checkNotNull(statusCode, "statusCode");
            this.statusCode = statusCode;
            return this;
        }

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

        /**
         * List of Plex Devices. This includes Plex hosted servers and clients
         */
        public Builder plexDevices(List<PlexDevice> plexDevices) {
            Utils.checkNotNull(plexDevices, "plexDevices");
            this.plexDevices = Optional.ofNullable(plexDevices);
            return this;
        }

        /**
         * List of Plex Devices. This includes Plex hosted servers and clients
         */
        public Builder plexDevices(Optional<? extends List<PlexDevice>> plexDevices) {
            Utils.checkNotNull(plexDevices, "plexDevices");
            this.plexDevices = plexDevices;
            return this;
        }
        
        public GetServerResourcesResponse build() {
            return new GetServerResourcesResponse(
                contentType,
                statusCode,
                rawResponse,
                plexDevices);
        }
    }
}

