/*
 * Jellyfin API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 10.11.6
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

package org.openhab.binding.jellyfin.internal.gen.current.model;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Objects;
import java.util.StringJoiner;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * PublicSystemInfo
 */
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "OpenAPI Generator")
public class PublicSystemInfo {
    public static final String JSON_PROPERTY_LOCAL_ADDRESS = "LocalAddress";
    private @org.eclipse.jdt.annotation.Nullable String localAddress;

    public static final String JSON_PROPERTY_SERVER_NAME = "ServerName";
    private @org.eclipse.jdt.annotation.Nullable String serverName;

    public static final String JSON_PROPERTY_VERSION = "Version";
    private @org.eclipse.jdt.annotation.Nullable String version;

    public static final String JSON_PROPERTY_PRODUCT_NAME = "ProductName";
    private @org.eclipse.jdt.annotation.Nullable String productName;

    public static final String JSON_PROPERTY_OPERATING_SYSTEM = "OperatingSystem";
    private @org.eclipse.jdt.annotation.Nullable String operatingSystem;

    public static final String JSON_PROPERTY_ID = "Id";
    private @org.eclipse.jdt.annotation.Nullable String id;

    public static final String JSON_PROPERTY_STARTUP_WIZARD_COMPLETED = "StartupWizardCompleted";
    private @org.eclipse.jdt.annotation.Nullable Boolean startupWizardCompleted;

    public PublicSystemInfo() {
    }

    public PublicSystemInfo localAddress(@org.eclipse.jdt.annotation.Nullable String localAddress) {
        this.localAddress = localAddress;
        return this;
    }

    /**
     * Gets or sets the local address.
     * 
     * @return localAddress
     */
    @JsonProperty(value = JSON_PROPERTY_LOCAL_ADDRESS)
    public @org.eclipse.jdt.annotation.Nullable String getLocalAddress() {
        return localAddress;
    }

    @JsonProperty(value = JSON_PROPERTY_LOCAL_ADDRESS)
    public void setLocalAddress(@org.eclipse.jdt.annotation.Nullable String localAddress) {
        this.localAddress = localAddress;
    }

    public PublicSystemInfo serverName(@org.eclipse.jdt.annotation.Nullable String serverName) {
        this.serverName = serverName;
        return this;
    }

    /**
     * Gets or sets the name of the server.
     * 
     * @return serverName
     */
    @JsonProperty(value = JSON_PROPERTY_SERVER_NAME)
    public @org.eclipse.jdt.annotation.Nullable String getServerName() {
        return serverName;
    }

    @JsonProperty(value = JSON_PROPERTY_SERVER_NAME)
    public void setServerName(@org.eclipse.jdt.annotation.Nullable String serverName) {
        this.serverName = serverName;
    }

    public PublicSystemInfo version(@org.eclipse.jdt.annotation.Nullable String version) {
        this.version = version;
        return this;
    }

    /**
     * Gets or sets the server version.
     * 
     * @return version
     */
    @JsonProperty(value = JSON_PROPERTY_VERSION)
    public @org.eclipse.jdt.annotation.Nullable String getVersion() {
        return version;
    }

    @JsonProperty(value = JSON_PROPERTY_VERSION)
    public void setVersion(@org.eclipse.jdt.annotation.Nullable String version) {
        this.version = version;
    }

    public PublicSystemInfo productName(@org.eclipse.jdt.annotation.Nullable String productName) {
        this.productName = productName;
        return this;
    }

    /**
     * Gets or sets the product name. This is the AssemblyProduct name.
     * 
     * @return productName
     */
    @JsonProperty(value = JSON_PROPERTY_PRODUCT_NAME)
    public @org.eclipse.jdt.annotation.Nullable String getProductName() {
        return productName;
    }

    @JsonProperty(value = JSON_PROPERTY_PRODUCT_NAME)
    public void setProductName(@org.eclipse.jdt.annotation.Nullable String productName) {
        this.productName = productName;
    }

    public PublicSystemInfo operatingSystem(@org.eclipse.jdt.annotation.Nullable String operatingSystem) {
        this.operatingSystem = operatingSystem;
        return this;
    }

    /**
     * Gets or sets the operating system.
     * 
     * @return operatingSystem
     * @deprecated
     */
    @Deprecated
    @JsonProperty(value = JSON_PROPERTY_OPERATING_SYSTEM)
    public @org.eclipse.jdt.annotation.Nullable String getOperatingSystem() {
        return operatingSystem;
    }

    @JsonProperty(value = JSON_PROPERTY_OPERATING_SYSTEM)
    public void setOperatingSystem(@org.eclipse.jdt.annotation.Nullable String operatingSystem) {
        this.operatingSystem = operatingSystem;
    }

    public PublicSystemInfo id(@org.eclipse.jdt.annotation.Nullable String id) {
        this.id = id;
        return this;
    }

    /**
     * Gets or sets the id.
     * 
     * @return id
     */
    @JsonProperty(value = JSON_PROPERTY_ID)
    public @org.eclipse.jdt.annotation.Nullable String getId() {
        return id;
    }

    @JsonProperty(value = JSON_PROPERTY_ID)
    public void setId(@org.eclipse.jdt.annotation.Nullable String id) {
        this.id = id;
    }

    public PublicSystemInfo startupWizardCompleted(
            @org.eclipse.jdt.annotation.Nullable Boolean startupWizardCompleted) {
        this.startupWizardCompleted = startupWizardCompleted;
        return this;
    }

    /**
     * Gets or sets a value indicating whether the startup wizard is completed.
     * 
     * @return startupWizardCompleted
     */
    @JsonProperty(value = JSON_PROPERTY_STARTUP_WIZARD_COMPLETED)
    public @org.eclipse.jdt.annotation.Nullable Boolean getStartupWizardCompleted() {
        return startupWizardCompleted;
    }

    @JsonProperty(value = JSON_PROPERTY_STARTUP_WIZARD_COMPLETED)
    public void setStartupWizardCompleted(@org.eclipse.jdt.annotation.Nullable Boolean startupWizardCompleted) {
        this.startupWizardCompleted = startupWizardCompleted;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        PublicSystemInfo publicSystemInfo = (PublicSystemInfo) o;
        return Objects.equals(this.localAddress, publicSystemInfo.localAddress)
                && Objects.equals(this.serverName, publicSystemInfo.serverName)
                && Objects.equals(this.version, publicSystemInfo.version)
                && Objects.equals(this.productName, publicSystemInfo.productName)
                && Objects.equals(this.operatingSystem, publicSystemInfo.operatingSystem)
                && Objects.equals(this.id, publicSystemInfo.id)
                && Objects.equals(this.startupWizardCompleted, publicSystemInfo.startupWizardCompleted);
    }

    @Override
    public int hashCode() {
        return Objects.hash(localAddress, serverName, version, productName, operatingSystem, id,
                startupWizardCompleted);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class PublicSystemInfo {\n");
        sb.append("    localAddress: ").append(toIndentedString(localAddress)).append("\n");
        sb.append("    serverName: ").append(toIndentedString(serverName)).append("\n");
        sb.append("    version: ").append(toIndentedString(version)).append("\n");
        sb.append("    productName: ").append(toIndentedString(productName)).append("\n");
        sb.append("    operatingSystem: ").append(toIndentedString(operatingSystem)).append("\n");
        sb.append("    id: ").append(toIndentedString(id)).append("\n");
        sb.append("    startupWizardCompleted: ").append(toIndentedString(startupWizardCompleted)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces
     * (except the first line).
     */
    private String toIndentedString(Object o) {
        return o == null ? "null" : o.toString().replace("\n", "\n    ");
    }

    /**
     * Convert the instance into URL query string.
     *
     * @return URL query string
     */
    public String toUrlQueryString() {
        return toUrlQueryString(null);
    }

    /**
     * Convert the instance into URL query string.
     *
     * @param prefix prefix of the query string
     * @return URL query string
     */
    public String toUrlQueryString(String prefix) {
        String suffix = "";
        String containerSuffix = "";
        String containerPrefix = "";
        if (prefix == null) {
            // style=form, explode=true, e.g. /pet?name=cat&type=manx
            prefix = "";
        } else {
            // deepObject style e.g. /pet?id[name]=cat&id[type]=manx
            prefix = prefix + "[";
            suffix = "]";
            containerSuffix = "]";
            containerPrefix = "[";
        }

        StringJoiner joiner = new StringJoiner("&");

        // add `LocalAddress` to the URL query string
        if (getLocalAddress() != null) {
            try {
                joiner.add(String.format(java.util.Locale.ROOT, "%sLocalAddress%s=%s", prefix, suffix,
                        URLEncoder.encode(String.valueOf(getLocalAddress()), "UTF-8").replaceAll("\\+", "%20")));
            } catch (UnsupportedEncodingException e) {
                // Should never happen, UTF-8 is always supported
                throw new RuntimeException(e);
            }
        }

        // add `ServerName` to the URL query string
        if (getServerName() != null) {
            try {
                joiner.add(String.format(java.util.Locale.ROOT, "%sServerName%s=%s", prefix, suffix,
                        URLEncoder.encode(String.valueOf(getServerName()), "UTF-8").replaceAll("\\+", "%20")));
            } catch (UnsupportedEncodingException e) {
                // Should never happen, UTF-8 is always supported
                throw new RuntimeException(e);
            }
        }

        // add `Version` to the URL query string
        if (getVersion() != null) {
            try {
                joiner.add(String.format(java.util.Locale.ROOT, "%sVersion%s=%s", prefix, suffix,
                        URLEncoder.encode(String.valueOf(getVersion()), "UTF-8").replaceAll("\\+", "%20")));
            } catch (UnsupportedEncodingException e) {
                // Should never happen, UTF-8 is always supported
                throw new RuntimeException(e);
            }
        }

        // add `ProductName` to the URL query string
        if (getProductName() != null) {
            try {
                joiner.add(String.format(java.util.Locale.ROOT, "%sProductName%s=%s", prefix, suffix,
                        URLEncoder.encode(String.valueOf(getProductName()), "UTF-8").replaceAll("\\+", "%20")));
            } catch (UnsupportedEncodingException e) {
                // Should never happen, UTF-8 is always supported
                throw new RuntimeException(e);
            }
        }

        // add `OperatingSystem` to the URL query string
        if (getOperatingSystem() != null) {
            try {
                joiner.add(String.format(java.util.Locale.ROOT, "%sOperatingSystem%s=%s", prefix, suffix,
                        URLEncoder.encode(String.valueOf(getOperatingSystem()), "UTF-8").replaceAll("\\+", "%20")));
            } catch (UnsupportedEncodingException e) {
                // Should never happen, UTF-8 is always supported
                throw new RuntimeException(e);
            }
        }

        // add `Id` to the URL query string
        if (getId() != null) {
            try {
                joiner.add(String.format(java.util.Locale.ROOT, "%sId%s=%s", prefix, suffix,
                        URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20")));
            } catch (UnsupportedEncodingException e) {
                // Should never happen, UTF-8 is always supported
                throw new RuntimeException(e);
            }
        }

        // add `StartupWizardCompleted` to the URL query string
        if (getStartupWizardCompleted() != null) {
            try {
                joiner.add(String.format(java.util.Locale.ROOT, "%sStartupWizardCompleted%s=%s", prefix, suffix,
                        URLEncoder.encode(String.valueOf(getStartupWizardCompleted()), "UTF-8").replaceAll("\\+",
                                "%20")));
            } catch (UnsupportedEncodingException e) {
                // Should never happen, UTF-8 is always supported
                throw new RuntimeException(e);
            }
        }

        return joiner.toString();
    }

    public static class Builder {

        private PublicSystemInfo instance;

        public Builder() {
            this(new PublicSystemInfo());
        }

        protected Builder(PublicSystemInfo instance) {
            this.instance = instance;
        }

        public PublicSystemInfo.Builder localAddress(String localAddress) {
            this.instance.localAddress = localAddress;
            return this;
        }

        public PublicSystemInfo.Builder serverName(String serverName) {
            this.instance.serverName = serverName;
            return this;
        }

        public PublicSystemInfo.Builder version(String version) {
            this.instance.version = version;
            return this;
        }

        public PublicSystemInfo.Builder productName(String productName) {
            this.instance.productName = productName;
            return this;
        }

        public PublicSystemInfo.Builder operatingSystem(String operatingSystem) {
            this.instance.operatingSystem = operatingSystem;
            return this;
        }

        public PublicSystemInfo.Builder id(String id) {
            this.instance.id = id;
            return this;
        }

        public PublicSystemInfo.Builder startupWizardCompleted(Boolean startupWizardCompleted) {
            this.instance.startupWizardCompleted = startupWizardCompleted;
            return this;
        }

        /**
         * returns a built PublicSystemInfo instance.
         *
         * The builder is not reusable.
         */
        public PublicSystemInfo build() {
            try {
                return this.instance;
            } finally {
                // ensure that this.instance is not reused
                this.instance = null;
            }
        }

        @Override
        public String toString() {
            return getClass() + "=(" + instance + ")";
        }
    }

    /**
     * Create a builder with no initialized field.
     */
    public static PublicSystemInfo.Builder builder() {
        return new PublicSystemInfo.Builder();
    }

    /**
     * Create a builder with a shallow copy of this instance.
     */
    public PublicSystemInfo.Builder toBuilder() {
        return new PublicSystemInfo.Builder().localAddress(getLocalAddress()).serverName(getServerName())
                .version(getVersion()).productName(getProductName()).operatingSystem(getOperatingSystem()).id(getId())
                .startupWizardCompleted(getStartupWizardCompleted());
    }
}
