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


public class GetRefreshLibraryMetadataRequest {

    /**
     * Force the refresh even if the library is already being refreshed.
     */
    @SpeakeasyMetadata("queryParam:style=form,explode=true,name=force")
    private Optional<? extends Force> force;

    /**
     * The unique key of the Plex library. 
     * Note: This is unique in the context of the Plex server.
     * 
     */
    @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=sectionKey")
    private int sectionKey;

    @JsonCreator
    public GetRefreshLibraryMetadataRequest(
            Optional<? extends Force> force,
            int sectionKey) {
        Utils.checkNotNull(force, "force");
        Utils.checkNotNull(sectionKey, "sectionKey");
        this.force = force;
        this.sectionKey = sectionKey;
    }
    
    public GetRefreshLibraryMetadataRequest(
            int sectionKey) {
        this(Optional.empty(), sectionKey);
    }

    /**
     * Force the refresh even if the library is already being refreshed.
     */
    @SuppressWarnings("unchecked")
    @JsonIgnore
    public Optional<Force> force() {
        return (Optional<Force>) force;
    }

    /**
     * The unique key of the Plex library. 
     * Note: This is unique in the context of the Plex server.
     * 
     */
    @JsonIgnore
    public int sectionKey() {
        return sectionKey;
    }

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

    /**
     * Force the refresh even if the library is already being refreshed.
     */
    public GetRefreshLibraryMetadataRequest withForce(Force force) {
        Utils.checkNotNull(force, "force");
        this.force = Optional.ofNullable(force);
        return this;
    }

    /**
     * Force the refresh even if the library is already being refreshed.
     */
    public GetRefreshLibraryMetadataRequest withForce(Optional<? extends Force> force) {
        Utils.checkNotNull(force, "force");
        this.force = force;
        return this;
    }

    /**
     * The unique key of the Plex library. 
     * Note: This is unique in the context of the Plex server.
     * 
     */
    public GetRefreshLibraryMetadataRequest withSectionKey(int sectionKey) {
        Utils.checkNotNull(sectionKey, "sectionKey");
        this.sectionKey = sectionKey;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        GetRefreshLibraryMetadataRequest other = (GetRefreshLibraryMetadataRequest) o;
        return 
            Objects.deepEquals(this.force, other.force) &&
            Objects.deepEquals(this.sectionKey, other.sectionKey);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            force,
            sectionKey);
    }
    
    @Override
    public String toString() {
        return Utils.toString(GetRefreshLibraryMetadataRequest.class,
                "force", force,
                "sectionKey", sectionKey);
    }
    
    public final static class Builder {
 
        private Optional<? extends Force> force = Optional.empty();
 
        private Integer sectionKey;  
        
        private Builder() {
          // force use of static builder() method
        }

        /**
         * Force the refresh even if the library is already being refreshed.
         */
        public Builder force(Force force) {
            Utils.checkNotNull(force, "force");
            this.force = Optional.ofNullable(force);
            return this;
        }

        /**
         * Force the refresh even if the library is already being refreshed.
         */
        public Builder force(Optional<? extends Force> force) {
            Utils.checkNotNull(force, "force");
            this.force = force;
            return this;
        }

        /**
         * The unique key of the Plex library. 
         * Note: This is unique in the context of the Plex server.
         * 
         */
        public Builder sectionKey(int sectionKey) {
            Utils.checkNotNull(sectionKey, "sectionKey");
            this.sectionKey = sectionKey;
            return this;
        }
        
        public GetRefreshLibraryMetadataRequest build() {
            return new GetRefreshLibraryMetadataRequest(
                force,
                sectionKey);
        }
    }
}

