/* 
 * 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.core.type.TypeReference;
import dev.plexapi.sdk.utils.LazySingletonValue;
import dev.plexapi.sdk.utils.SpeakeasyMetadata;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.Objects;
import java.util.Optional;


public class GetServerResourcesRequest {

    /**
     * Include Https entries in the results
     */
    @SpeakeasyMetadata("queryParam:style=form,explode=true,name=includeHttps")
    private Optional<? extends IncludeHttps> includeHttps;

    /**
     * Include Relay addresses in the results 
     * E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400
     * 
     */
    @SpeakeasyMetadata("queryParam:style=form,explode=true,name=includeRelay")
    private Optional<? extends IncludeRelay> includeRelay;

    /**
     * Include IPv6 entries in the results
     */
    @SpeakeasyMetadata("queryParam:style=form,explode=true,name=includeIPv6")
    private Optional<? extends IncludeIPv6> includeIPv6;

    /**
     * An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
     */
    @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Client-Identifier")
    private Optional<String> clientID;

    @JsonCreator
    public GetServerResourcesRequest(
            Optional<? extends IncludeHttps> includeHttps,
            Optional<? extends IncludeRelay> includeRelay,
            Optional<? extends IncludeIPv6> includeIPv6,
            Optional<String> clientID) {
        Utils.checkNotNull(includeHttps, "includeHttps");
        Utils.checkNotNull(includeRelay, "includeRelay");
        Utils.checkNotNull(includeIPv6, "includeIPv6");
        Utils.checkNotNull(clientID, "clientID");
        this.includeHttps = includeHttps;
        this.includeRelay = includeRelay;
        this.includeIPv6 = includeIPv6;
        this.clientID = clientID;
    }
    
    public GetServerResourcesRequest() {
        this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
    }

    /**
     * Include Https entries in the results
     */
    @SuppressWarnings("unchecked")
    @JsonIgnore
    public Optional<IncludeHttps> includeHttps() {
        return (Optional<IncludeHttps>) includeHttps;
    }

    /**
     * Include Relay addresses in the results 
     * E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400
     * 
     */
    @SuppressWarnings("unchecked")
    @JsonIgnore
    public Optional<IncludeRelay> includeRelay() {
        return (Optional<IncludeRelay>) includeRelay;
    }

    /**
     * Include IPv6 entries in the results
     */
    @SuppressWarnings("unchecked")
    @JsonIgnore
    public Optional<IncludeIPv6> includeIPv6() {
        return (Optional<IncludeIPv6>) includeIPv6;
    }

    /**
     * An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
     */
    @JsonIgnore
    public Optional<String> clientID() {
        return clientID;
    }

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

    /**
     * Include Https entries in the results
     */
    public GetServerResourcesRequest withIncludeHttps(IncludeHttps includeHttps) {
        Utils.checkNotNull(includeHttps, "includeHttps");
        this.includeHttps = Optional.ofNullable(includeHttps);
        return this;
    }

    /**
     * Include Https entries in the results
     */
    public GetServerResourcesRequest withIncludeHttps(Optional<? extends IncludeHttps> includeHttps) {
        Utils.checkNotNull(includeHttps, "includeHttps");
        this.includeHttps = includeHttps;
        return this;
    }

    /**
     * Include Relay addresses in the results 
     * E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400
     * 
     */
    public GetServerResourcesRequest withIncludeRelay(IncludeRelay includeRelay) {
        Utils.checkNotNull(includeRelay, "includeRelay");
        this.includeRelay = Optional.ofNullable(includeRelay);
        return this;
    }

    /**
     * Include Relay addresses in the results 
     * E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400
     * 
     */
    public GetServerResourcesRequest withIncludeRelay(Optional<? extends IncludeRelay> includeRelay) {
        Utils.checkNotNull(includeRelay, "includeRelay");
        this.includeRelay = includeRelay;
        return this;
    }

    /**
     * Include IPv6 entries in the results
     */
    public GetServerResourcesRequest withIncludeIPv6(IncludeIPv6 includeIPv6) {
        Utils.checkNotNull(includeIPv6, "includeIPv6");
        this.includeIPv6 = Optional.ofNullable(includeIPv6);
        return this;
    }

    /**
     * Include IPv6 entries in the results
     */
    public GetServerResourcesRequest withIncludeIPv6(Optional<? extends IncludeIPv6> includeIPv6) {
        Utils.checkNotNull(includeIPv6, "includeIPv6");
        this.includeIPv6 = includeIPv6;
        return this;
    }

    /**
     * An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
     */
    public GetServerResourcesRequest withClientID(String clientID) {
        Utils.checkNotNull(clientID, "clientID");
        this.clientID = Optional.ofNullable(clientID);
        return this;
    }

    /**
     * An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
     */
    public GetServerResourcesRequest withClientID(Optional<String> clientID) {
        Utils.checkNotNull(clientID, "clientID");
        this.clientID = clientID;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        GetServerResourcesRequest other = (GetServerResourcesRequest) o;
        return 
            Objects.deepEquals(this.includeHttps, other.includeHttps) &&
            Objects.deepEquals(this.includeRelay, other.includeRelay) &&
            Objects.deepEquals(this.includeIPv6, other.includeIPv6) &&
            Objects.deepEquals(this.clientID, other.clientID);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            includeHttps,
            includeRelay,
            includeIPv6,
            clientID);
    }
    
    @Override
    public String toString() {
        return Utils.toString(GetServerResourcesRequest.class,
                "includeHttps", includeHttps,
                "includeRelay", includeRelay,
                "includeIPv6", includeIPv6,
                "clientID", clientID);
    }
    
    public final static class Builder {
 
        private Optional<? extends IncludeHttps> includeHttps;
 
        private Optional<? extends IncludeRelay> includeRelay;
 
        private Optional<? extends IncludeIPv6> includeIPv6;
 
        private Optional<String> clientID = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

        /**
         * Include Https entries in the results
         */
        public Builder includeHttps(IncludeHttps includeHttps) {
            Utils.checkNotNull(includeHttps, "includeHttps");
            this.includeHttps = Optional.ofNullable(includeHttps);
            return this;
        }

        /**
         * Include Https entries in the results
         */
        public Builder includeHttps(Optional<? extends IncludeHttps> includeHttps) {
            Utils.checkNotNull(includeHttps, "includeHttps");
            this.includeHttps = includeHttps;
            return this;
        }

        /**
         * Include Relay addresses in the results 
         * E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400
         * 
         */
        public Builder includeRelay(IncludeRelay includeRelay) {
            Utils.checkNotNull(includeRelay, "includeRelay");
            this.includeRelay = Optional.ofNullable(includeRelay);
            return this;
        }

        /**
         * Include Relay addresses in the results 
         * E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400
         * 
         */
        public Builder includeRelay(Optional<? extends IncludeRelay> includeRelay) {
            Utils.checkNotNull(includeRelay, "includeRelay");
            this.includeRelay = includeRelay;
            return this;
        }

        /**
         * Include IPv6 entries in the results
         */
        public Builder includeIPv6(IncludeIPv6 includeIPv6) {
            Utils.checkNotNull(includeIPv6, "includeIPv6");
            this.includeIPv6 = Optional.ofNullable(includeIPv6);
            return this;
        }

        /**
         * Include IPv6 entries in the results
         */
        public Builder includeIPv6(Optional<? extends IncludeIPv6> includeIPv6) {
            Utils.checkNotNull(includeIPv6, "includeIPv6");
            this.includeIPv6 = includeIPv6;
            return this;
        }

        /**
         * An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
         */
        public Builder clientID(String clientID) {
            Utils.checkNotNull(clientID, "clientID");
            this.clientID = Optional.ofNullable(clientID);
            return this;
        }

        /**
         * An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
         */
        public Builder clientID(Optional<String> clientID) {
            Utils.checkNotNull(clientID, "clientID");
            this.clientID = clientID;
            return this;
        }
        
        public GetServerResourcesRequest build() {
            if (includeHttps == null) {
                includeHttps = _SINGLETON_VALUE_IncludeHttps.value();
            }
            if (includeRelay == null) {
                includeRelay = _SINGLETON_VALUE_IncludeRelay.value();
            }
            if (includeIPv6 == null) {
                includeIPv6 = _SINGLETON_VALUE_IncludeIPv6.value();
            }            return new GetServerResourcesRequest(
                includeHttps,
                includeRelay,
                includeIPv6,
                clientID);
        }

        private static final LazySingletonValue<Optional<? extends IncludeHttps>> _SINGLETON_VALUE_IncludeHttps =
                new LazySingletonValue<>(
                        "includeHttps",
                        "0",
                        new TypeReference<Optional<? extends IncludeHttps>>() {});

        private static final LazySingletonValue<Optional<? extends IncludeRelay>> _SINGLETON_VALUE_IncludeRelay =
                new LazySingletonValue<>(
                        "includeRelay",
                        "0",
                        new TypeReference<Optional<? extends IncludeRelay>>() {});

        private static final LazySingletonValue<Optional<? extends IncludeIPv6>> _SINGLETON_VALUE_IncludeIPv6 =
                new LazySingletonValue<>(
                        "includeIPv6",
                        "0",
                        new TypeReference<Optional<? extends IncludeIPv6>>() {});
    }
}

