/* 
 * 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 Device {

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

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

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

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

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

    @JsonCreator
    public Device(
            @JsonProperty("id") Optional<Double> id,
            @JsonProperty("name") Optional<String> name,
            @JsonProperty("platform") Optional<String> platform,
            @JsonProperty("clientIdentifier") Optional<String> clientIdentifier,
            @JsonProperty("createdAt") Optional<Double> createdAt) {
        Utils.checkNotNull(id, "id");
        Utils.checkNotNull(name, "name");
        Utils.checkNotNull(platform, "platform");
        Utils.checkNotNull(clientIdentifier, "clientIdentifier");
        Utils.checkNotNull(createdAt, "createdAt");
        this.id = id;
        this.name = name;
        this.platform = platform;
        this.clientIdentifier = clientIdentifier;
        this.createdAt = createdAt;
    }
    
    public Device() {
        this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
    }

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

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

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

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

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

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

    public Device withId(double id) {
        Utils.checkNotNull(id, "id");
        this.id = Optional.ofNullable(id);
        return this;
    }

    public Device withId(Optional<Double> id) {
        Utils.checkNotNull(id, "id");
        this.id = id;
        return this;
    }

    public Device withName(String name) {
        Utils.checkNotNull(name, "name");
        this.name = Optional.ofNullable(name);
        return this;
    }

    public Device withName(Optional<String> name) {
        Utils.checkNotNull(name, "name");
        this.name = name;
        return this;
    }

    public Device withPlatform(String platform) {
        Utils.checkNotNull(platform, "platform");
        this.platform = Optional.ofNullable(platform);
        return this;
    }

    public Device withPlatform(Optional<String> platform) {
        Utils.checkNotNull(platform, "platform");
        this.platform = platform;
        return this;
    }

    public Device withClientIdentifier(String clientIdentifier) {
        Utils.checkNotNull(clientIdentifier, "clientIdentifier");
        this.clientIdentifier = Optional.ofNullable(clientIdentifier);
        return this;
    }

    public Device withClientIdentifier(Optional<String> clientIdentifier) {
        Utils.checkNotNull(clientIdentifier, "clientIdentifier");
        this.clientIdentifier = clientIdentifier;
        return this;
    }

    public Device withCreatedAt(double createdAt) {
        Utils.checkNotNull(createdAt, "createdAt");
        this.createdAt = Optional.ofNullable(createdAt);
        return this;
    }

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

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

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

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

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

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

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

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

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

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

        public Builder createdAt(Optional<Double> createdAt) {
            Utils.checkNotNull(createdAt, "createdAt");
            this.createdAt = createdAt;
            return this;
        }
        
        public Device build() {
            return new Device(
                id,
                name,
                platform,
                clientIdentifier,
                createdAt);
        }
    }
}

