/* 
 * 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.JsonProperty;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Boolean;
import java.lang.Double;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;


public class Connections {

    @JsonProperty("protocol")
    private String protocol;

    @JsonProperty("address")
    private String address;

    @JsonProperty("port")
    private double port;

    @JsonProperty("uri")
    private String uri;

    @JsonProperty("local")
    private boolean local;

    @JsonProperty("relay")
    private boolean relay;

    @JsonProperty("IPv6")
    private boolean iPv6;

    @JsonCreator
    public Connections(
            @JsonProperty("protocol") String protocol,
            @JsonProperty("address") String address,
            @JsonProperty("port") double port,
            @JsonProperty("uri") String uri,
            @JsonProperty("local") boolean local,
            @JsonProperty("relay") boolean relay,
            @JsonProperty("IPv6") boolean iPv6) {
        Utils.checkNotNull(protocol, "protocol");
        Utils.checkNotNull(address, "address");
        Utils.checkNotNull(port, "port");
        Utils.checkNotNull(uri, "uri");
        Utils.checkNotNull(local, "local");
        Utils.checkNotNull(relay, "relay");
        Utils.checkNotNull(iPv6, "iPv6");
        this.protocol = protocol;
        this.address = address;
        this.port = port;
        this.uri = uri;
        this.local = local;
        this.relay = relay;
        this.iPv6 = iPv6;
    }

    @JsonIgnore
    public String protocol() {
        return protocol;
    }

    @JsonIgnore
    public String address() {
        return address;
    }

    @JsonIgnore
    public double port() {
        return port;
    }

    @JsonIgnore
    public String uri() {
        return uri;
    }

    @JsonIgnore
    public boolean local() {
        return local;
    }

    @JsonIgnore
    public boolean relay() {
        return relay;
    }

    @JsonIgnore
    public boolean iPv6() {
        return iPv6;
    }

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

    public Connections withProtocol(String protocol) {
        Utils.checkNotNull(protocol, "protocol");
        this.protocol = protocol;
        return this;
    }

    public Connections withAddress(String address) {
        Utils.checkNotNull(address, "address");
        this.address = address;
        return this;
    }

    public Connections withPort(double port) {
        Utils.checkNotNull(port, "port");
        this.port = port;
        return this;
    }

    public Connections withUri(String uri) {
        Utils.checkNotNull(uri, "uri");
        this.uri = uri;
        return this;
    }

    public Connections withLocal(boolean local) {
        Utils.checkNotNull(local, "local");
        this.local = local;
        return this;
    }

    public Connections withRelay(boolean relay) {
        Utils.checkNotNull(relay, "relay");
        this.relay = relay;
        return this;
    }

    public Connections withIPv6(boolean iPv6) {
        Utils.checkNotNull(iPv6, "iPv6");
        this.iPv6 = iPv6;
        return this;
    }
    
    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Connections other = (Connections) o;
        return 
            Objects.deepEquals(this.protocol, other.protocol) &&
            Objects.deepEquals(this.address, other.address) &&
            Objects.deepEquals(this.port, other.port) &&
            Objects.deepEquals(this.uri, other.uri) &&
            Objects.deepEquals(this.local, other.local) &&
            Objects.deepEquals(this.relay, other.relay) &&
            Objects.deepEquals(this.iPv6, other.iPv6);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(
            protocol,
            address,
            port,
            uri,
            local,
            relay,
            iPv6);
    }
    
    @Override
    public String toString() {
        return Utils.toString(Connections.class,
                "protocol", protocol,
                "address", address,
                "port", port,
                "uri", uri,
                "local", local,
                "relay", relay,
                "iPv6", iPv6);
    }
    
    public final static class Builder {
 
        private String protocol;
 
        private String address;
 
        private Double port;
 
        private String uri;
 
        private Boolean local;
 
        private Boolean relay;
 
        private Boolean iPv6;  
        
        private Builder() {
          // force use of static builder() method
        }

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

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

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

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

        public Builder local(boolean local) {
            Utils.checkNotNull(local, "local");
            this.local = local;
            return this;
        }

        public Builder relay(boolean relay) {
            Utils.checkNotNull(relay, "relay");
            this.relay = relay;
            return this;
        }

        public Builder iPv6(boolean iPv6) {
            Utils.checkNotNull(iPv6, "iPv6");
            this.iPv6 = iPv6;
            return this;
        }
        
        public Connections build() {
            return new Connections(
                protocol,
                address,
                port,
                uri,
                local,
                relay,
                iPv6);
        }
    }
}

