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

/**
 * GetMyPlexAccountResponseBody - MyPlex Account
 */

public class GetMyPlexAccountResponseBody {

    @JsonInclude(Include.NON_ABSENT)
    @JsonProperty("MyPlex")
    private Optional<? extends MyPlex> myPlex;

    @JsonCreator
    public GetMyPlexAccountResponseBody(
            @JsonProperty("MyPlex") Optional<? extends MyPlex> myPlex) {
        Utils.checkNotNull(myPlex, "myPlex");
        this.myPlex = myPlex;
    }
    
    public GetMyPlexAccountResponseBody() {
        this(Optional.empty());
    }

    @SuppressWarnings("unchecked")
    @JsonIgnore
    public Optional<MyPlex> myPlex() {
        return (Optional<MyPlex>) myPlex;
    }

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

    public GetMyPlexAccountResponseBody withMyPlex(MyPlex myPlex) {
        Utils.checkNotNull(myPlex, "myPlex");
        this.myPlex = Optional.ofNullable(myPlex);
        return this;
    }

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

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

        public Builder myPlex(Optional<? extends MyPlex> myPlex) {
            Utils.checkNotNull(myPlex, "myPlex");
            this.myPlex = myPlex;
            return this;
        }
        
        public GetMyPlexAccountResponseBody build() {
            return new GetMyPlexAccountResponseBody(
                myPlex);
        }
    }
}

