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


public class GetServerListMediaContainer {

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

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("Server")
    private Optional<? extends List<GetServerListServer>> server;

    @JsonCreator
    public GetServerListMediaContainer(
            @JsonProperty("size") Optional<Double> size,
            @JsonProperty("Server") Optional<? extends List<GetServerListServer>> server) {
        Utils.checkNotNull(size, "size");
        Utils.checkNotNull(server, "server");
        this.size = size;
        this.server = server;
    }
    
    public GetServerListMediaContainer() {
        this(Optional.empty(), Optional.empty());
    }

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

    @SuppressWarnings("unchecked")
    @JsonIgnore
    public Optional<List<GetServerListServer>> server() {
        return (Optional<List<GetServerListServer>>) server;
    }

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

    public GetServerListMediaContainer withSize(double size) {
        Utils.checkNotNull(size, "size");
        this.size = Optional.ofNullable(size);
        return this;
    }

    public GetServerListMediaContainer withSize(Optional<Double> size) {
        Utils.checkNotNull(size, "size");
        this.size = size;
        return this;
    }

    public GetServerListMediaContainer withServer(List<GetServerListServer> server) {
        Utils.checkNotNull(server, "server");
        this.server = Optional.ofNullable(server);
        return this;
    }

    public GetServerListMediaContainer withServer(Optional<? extends List<GetServerListServer>> server) {
        Utils.checkNotNull(server, "server");
        this.server = server;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        GetServerListMediaContainer other = (GetServerListMediaContainer) o;
        return 
            Objects.deepEquals(this.size, other.size) &&
            Objects.deepEquals(this.server, other.server);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            size,
            server);
    }
    
    @Override
    public String toString() {
        return Utils.toString(GetServerListMediaContainer.class,
                "size", size,
                "server", server);
    }
    
    public final static class Builder {
 
        private Optional<Double> size = Optional.empty();
 
        private Optional<? extends List<GetServerListServer>> server = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

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

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

        public Builder server(List<GetServerListServer> server) {
            Utils.checkNotNull(server, "server");
            this.server = Optional.ofNullable(server);
            return this;
        }

        public Builder server(Optional<? extends List<GetServerListServer>> server) {
            Utils.checkNotNull(server, "server");
            this.server = server;
            return this;
        }
        
        public GetServerListMediaContainer build() {
            return new GetServerListMediaContainer(
                size,
                server);
        }
    }
}

