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

/**
 * GetUsersResponseBody - Successful response with media container data in XML
 */

public class GetUsersResponseBody {

    /**
     * Container holding user and server details.
     */
    private Optional<? extends GetUsersMediaContainer> mediaContainer;

    @JsonCreator
    public GetUsersResponseBody(
            Optional<? extends GetUsersMediaContainer> mediaContainer) {
        Utils.checkNotNull(mediaContainer, "mediaContainer");
        this.mediaContainer = mediaContainer;
    }
    
    public GetUsersResponseBody() {
        this(Optional.empty());
    }

    /**
     * Container holding user and server details.
     */
    @SuppressWarnings("unchecked")
    @JsonIgnore
    public Optional<GetUsersMediaContainer> mediaContainer() {
        return (Optional<GetUsersMediaContainer>) mediaContainer;
    }

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

    /**
     * Container holding user and server details.
     */
    public GetUsersResponseBody withMediaContainer(GetUsersMediaContainer mediaContainer) {
        Utils.checkNotNull(mediaContainer, "mediaContainer");
        this.mediaContainer = Optional.ofNullable(mediaContainer);
        return this;
    }

    /**
     * Container holding user and server details.
     */
    public GetUsersResponseBody withMediaContainer(Optional<? extends GetUsersMediaContainer> mediaContainer) {
        Utils.checkNotNull(mediaContainer, "mediaContainer");
        this.mediaContainer = mediaContainer;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        GetUsersResponseBody other = (GetUsersResponseBody) o;
        return 
            Objects.deepEquals(this.mediaContainer, other.mediaContainer);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            mediaContainer);
    }
    
    @Override
    public String toString() {
        return Utils.toString(GetUsersResponseBody.class,
                "mediaContainer", mediaContainer);
    }
    
    public final static class Builder {
 
        private Optional<? extends GetUsersMediaContainer> mediaContainer = Optional.empty();  
        
        private Builder() {
          // force use of static builder() method
        }

        /**
         * Container holding user and server details.
         */
        public Builder mediaContainer(GetUsersMediaContainer mediaContainer) {
            Utils.checkNotNull(mediaContainer, "mediaContainer");
            this.mediaContainer = Optional.ofNullable(mediaContainer);
            return this;
        }

        /**
         * Container holding user and server details.
         */
        public Builder mediaContainer(Optional<? extends GetUsersMediaContainer> mediaContainer) {
            Utils.checkNotNull(mediaContainer, "mediaContainer");
            this.mediaContainer = mediaContainer;
            return this;
        }
        
        public GetUsersResponseBody build() {
            return new GetUsersResponseBody(
                mediaContainer);
        }
    }
}

