/* 
 * 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.Double;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;


public class GetFileHashRequest {

    /**
     * This is the path to the local file, must be prefixed by `file://`
     */
    @SpeakeasyMetadata("queryParam:style=form,explode=true,name=url")
    private String url;

    /**
     * Item type
     */
    @SpeakeasyMetadata("queryParam:style=form,explode=true,name=type")
    private Optional<Double> type;

    @JsonCreator
    public GetFileHashRequest(
            String url,
            Optional<Double> type) {
        Utils.checkNotNull(url, "url");
        Utils.checkNotNull(type, "type");
        this.url = url;
        this.type = type;
    }
    
    public GetFileHashRequest(
            String url) {
        this(url, Optional.empty());
    }

    /**
     * This is the path to the local file, must be prefixed by `file://`
     */
    @JsonIgnore
    public String url() {
        return url;
    }

    /**
     * Item type
     */
    @JsonIgnore
    public Optional<Double> type() {
        return type;
    }

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

    /**
     * This is the path to the local file, must be prefixed by `file://`
     */
    public GetFileHashRequest withUrl(String url) {
        Utils.checkNotNull(url, "url");
        this.url = url;
        return this;
    }

    /**
     * Item type
     */
    public GetFileHashRequest withType(double type) {
        Utils.checkNotNull(type, "type");
        this.type = Optional.ofNullable(type);
        return this;
    }

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

        /**
         * This is the path to the local file, must be prefixed by `file://`
         */
        public Builder url(String url) {
            Utils.checkNotNull(url, "url");
            this.url = url;
            return this;
        }

        /**
         * Item type
         */
        public Builder type(double type) {
            Utils.checkNotNull(type, "type");
            this.type = Optional.ofNullable(type);
            return this;
        }

        /**
         * Item type
         */
        public Builder type(Optional<Double> type) {
            Utils.checkNotNull(type, "type");
            this.type = type;
            return this;
        }
        
        public GetFileHashRequest build() {
            return new GetFileHashRequest(
                url,
                type);
        }
    }
}

