/* 
 * 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.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
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 Ratings {

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

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("value")
    private Optional<Double> value;

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

    @JsonCreator
    public Ratings(
            @JsonProperty("image") Optional<String> image,
            @JsonProperty("value") Optional<Double> value,
            @JsonProperty("type") Optional<String> type) {
        Utils.checkNotNull(image, "image");
        Utils.checkNotNull(value, "value");
        Utils.checkNotNull(type, "type");
        this.image = image;
        this.value = value;
        this.type = type;
    }
    
    public Ratings() {
        this(Optional.empty(), Optional.empty(), Optional.empty());
    }

    @JsonIgnore
    public Optional<String> image() {
        return image;
    }

    @JsonIgnore
    public Optional<Double> value() {
        return value;
    }

    @JsonIgnore
    public Optional<String> type() {
        return type;
    }

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

    public Ratings withImage(String image) {
        Utils.checkNotNull(image, "image");
        this.image = Optional.ofNullable(image);
        return this;
    }

    public Ratings withImage(Optional<String> image) {
        Utils.checkNotNull(image, "image");
        this.image = image;
        return this;
    }

    public Ratings withValue(double value) {
        Utils.checkNotNull(value, "value");
        this.value = Optional.ofNullable(value);
        return this;
    }

    public Ratings withValue(Optional<Double> value) {
        Utils.checkNotNull(value, "value");
        this.value = value;
        return this;
    }

    public Ratings withType(String type) {
        Utils.checkNotNull(type, "type");
        this.type = Optional.ofNullable(type);
        return this;
    }

    public Ratings withType(Optional<String> 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;
        }
        Ratings other = (Ratings) o;
        return 
            Objects.deepEquals(this.image, other.image) &&
            Objects.deepEquals(this.value, other.value) &&
            Objects.deepEquals(this.type, other.type);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            image,
            value,
            type);
    }
    
    @Override
    public String toString() {
        return Utils.toString(Ratings.class,
                "image", image,
                "value", value,
                "type", type);
    }
    
    public final static class Builder {
 
        private Optional<String> image = Optional.empty();
 
        private Optional<Double> value = Optional.empty();
 
        private Optional<String> type = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

        public Builder image(String image) {
            Utils.checkNotNull(image, "image");
            this.image = Optional.ofNullable(image);
            return this;
        }

        public Builder image(Optional<String> image) {
            Utils.checkNotNull(image, "image");
            this.image = image;
            return this;
        }

        public Builder value(double value) {
            Utils.checkNotNull(value, "value");
            this.value = Optional.ofNullable(value);
            return this;
        }

        public Builder value(Optional<Double> value) {
            Utils.checkNotNull(value, "value");
            this.value = value;
            return this;
        }

        public Builder type(String type) {
            Utils.checkNotNull(type, "type");
            this.type = Optional.ofNullable(type);
            return this;
        }

        public Builder type(Optional<String> type) {
            Utils.checkNotNull(type, "type");
            this.type = type;
            return this;
        }
        
        public Ratings build() {
            return new Ratings(
                image,
                value,
                type);
        }
    }
}

