/*
 * 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.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.StringJoiner;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

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

    public static final String JSON_PROPERTY_ORIGINAL_TITLE = "OriginalTitle";
    private @org.eclipse.jdt.annotation.Nullable String originalTitle;

    public static final String JSON_PROPERTY_PATH = "Path";
    private @org.eclipse.jdt.annotation.Nullable String path;

    public static final String JSON_PROPERTY_METADATA_LANGUAGE = "MetadataLanguage";
    private @org.eclipse.jdt.annotation.Nullable String metadataLanguage;

    public static final String JSON_PROPERTY_METADATA_COUNTRY_CODE = "MetadataCountryCode";
    private @org.eclipse.jdt.annotation.Nullable String metadataCountryCode;

    public static final String JSON_PROPERTY_PROVIDER_IDS = "ProviderIds";
    private @org.eclipse.jdt.annotation.Nullable Map<String, String> providerIds;

    public static final String JSON_PROPERTY_YEAR = "Year";
    private @org.eclipse.jdt.annotation.Nullable Integer year;

    public static final String JSON_PROPERTY_INDEX_NUMBER = "IndexNumber";
    private @org.eclipse.jdt.annotation.Nullable Integer indexNumber;

    public static final String JSON_PROPERTY_PARENT_INDEX_NUMBER = "ParentIndexNumber";
    private @org.eclipse.jdt.annotation.Nullable Integer parentIndexNumber;

    public static final String JSON_PROPERTY_PREMIERE_DATE = "PremiereDate";
    private @org.eclipse.jdt.annotation.Nullable OffsetDateTime premiereDate;

    public static final String JSON_PROPERTY_IS_AUTOMATED = "IsAutomated";
    private @org.eclipse.jdt.annotation.Nullable Boolean isAutomated;

    public BoxSetInfo() {
    }

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

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

    @JsonProperty(value = JSON_PROPERTY_NAME)
    public void setName(@org.eclipse.jdt.annotation.Nullable String name) {
        this.name = name;
    }

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

    /**
     * Gets or sets the original title.
     * 
     * @return originalTitle
     */
    @JsonProperty(value = JSON_PROPERTY_ORIGINAL_TITLE)
    public @org.eclipse.jdt.annotation.Nullable String getOriginalTitle() {
        return originalTitle;
    }

    @JsonProperty(value = JSON_PROPERTY_ORIGINAL_TITLE)
    public void setOriginalTitle(@org.eclipse.jdt.annotation.Nullable String originalTitle) {
        this.originalTitle = originalTitle;
    }

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

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

    @JsonProperty(value = JSON_PROPERTY_PATH)
    public void setPath(@org.eclipse.jdt.annotation.Nullable String path) {
        this.path = path;
    }

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

    /**
     * Gets or sets the metadata language.
     * 
     * @return metadataLanguage
     */
    @JsonProperty(value = JSON_PROPERTY_METADATA_LANGUAGE)
    public @org.eclipse.jdt.annotation.Nullable String getMetadataLanguage() {
        return metadataLanguage;
    }

    @JsonProperty(value = JSON_PROPERTY_METADATA_LANGUAGE)
    public void setMetadataLanguage(@org.eclipse.jdt.annotation.Nullable String metadataLanguage) {
        this.metadataLanguage = metadataLanguage;
    }

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

    /**
     * Gets or sets the metadata country code.
     * 
     * @return metadataCountryCode
     */
    @JsonProperty(value = JSON_PROPERTY_METADATA_COUNTRY_CODE)
    public @org.eclipse.jdt.annotation.Nullable String getMetadataCountryCode() {
        return metadataCountryCode;
    }

    @JsonProperty(value = JSON_PROPERTY_METADATA_COUNTRY_CODE)
    public void setMetadataCountryCode(@org.eclipse.jdt.annotation.Nullable String metadataCountryCode) {
        this.metadataCountryCode = metadataCountryCode;
    }

    public BoxSetInfo providerIds(@org.eclipse.jdt.annotation.Nullable Map<String, String> providerIds) {
        this.providerIds = providerIds;
        return this;
    }

    public BoxSetInfo putProviderIdsItem(String key, String providerIdsItem) {
        if (this.providerIds == null) {
            this.providerIds = new HashMap<>();
        }
        this.providerIds.put(key, providerIdsItem);
        return this;
    }

    /**
     * Gets or sets the provider ids.
     * 
     * @return providerIds
     */
    @JsonProperty(value = JSON_PROPERTY_PROVIDER_IDS)
    @JsonInclude(content = JsonInclude.Include.ALWAYS)
    public @org.eclipse.jdt.annotation.Nullable Map<String, String> getProviderIds() {
        return providerIds;
    }

    @JsonProperty(value = JSON_PROPERTY_PROVIDER_IDS)
    @JsonInclude(content = JsonInclude.Include.ALWAYS)
    public void setProviderIds(@org.eclipse.jdt.annotation.Nullable Map<String, String> providerIds) {
        this.providerIds = providerIds;
    }

    public BoxSetInfo year(@org.eclipse.jdt.annotation.Nullable Integer year) {
        this.year = year;
        return this;
    }

    /**
     * Gets or sets the year.
     * 
     * @return year
     */
    @JsonProperty(value = JSON_PROPERTY_YEAR)
    public @org.eclipse.jdt.annotation.Nullable Integer getYear() {
        return year;
    }

    @JsonProperty(value = JSON_PROPERTY_YEAR)
    public void setYear(@org.eclipse.jdt.annotation.Nullable Integer year) {
        this.year = year;
    }

    public BoxSetInfo indexNumber(@org.eclipse.jdt.annotation.Nullable Integer indexNumber) {
        this.indexNumber = indexNumber;
        return this;
    }

    /**
     * Get indexNumber
     * 
     * @return indexNumber
     */
    @JsonProperty(value = JSON_PROPERTY_INDEX_NUMBER)
    public @org.eclipse.jdt.annotation.Nullable Integer getIndexNumber() {
        return indexNumber;
    }

    @JsonProperty(value = JSON_PROPERTY_INDEX_NUMBER)
    public void setIndexNumber(@org.eclipse.jdt.annotation.Nullable Integer indexNumber) {
        this.indexNumber = indexNumber;
    }

    public BoxSetInfo parentIndexNumber(@org.eclipse.jdt.annotation.Nullable Integer parentIndexNumber) {
        this.parentIndexNumber = parentIndexNumber;
        return this;
    }

    /**
     * Get parentIndexNumber
     * 
     * @return parentIndexNumber
     */
    @JsonProperty(value = JSON_PROPERTY_PARENT_INDEX_NUMBER)
    public @org.eclipse.jdt.annotation.Nullable Integer getParentIndexNumber() {
        return parentIndexNumber;
    }

    @JsonProperty(value = JSON_PROPERTY_PARENT_INDEX_NUMBER)
    public void setParentIndexNumber(@org.eclipse.jdt.annotation.Nullable Integer parentIndexNumber) {
        this.parentIndexNumber = parentIndexNumber;
    }

    public BoxSetInfo premiereDate(@org.eclipse.jdt.annotation.Nullable OffsetDateTime premiereDate) {
        this.premiereDate = premiereDate;
        return this;
    }

    /**
     * Get premiereDate
     * 
     * @return premiereDate
     */
    @JsonProperty(value = JSON_PROPERTY_PREMIERE_DATE)
    public @org.eclipse.jdt.annotation.Nullable OffsetDateTime getPremiereDate() {
        return premiereDate;
    }

    @JsonProperty(value = JSON_PROPERTY_PREMIERE_DATE)
    public void setPremiereDate(@org.eclipse.jdt.annotation.Nullable OffsetDateTime premiereDate) {
        this.premiereDate = premiereDate;
    }

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

    /**
     * Get isAutomated
     * 
     * @return isAutomated
     */
    @JsonProperty(value = JSON_PROPERTY_IS_AUTOMATED)
    public @org.eclipse.jdt.annotation.Nullable Boolean getIsAutomated() {
        return isAutomated;
    }

    @JsonProperty(value = JSON_PROPERTY_IS_AUTOMATED)
    public void setIsAutomated(@org.eclipse.jdt.annotation.Nullable Boolean isAutomated) {
        this.isAutomated = isAutomated;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        BoxSetInfo boxSetInfo = (BoxSetInfo) o;
        return Objects.equals(this.name, boxSetInfo.name)
                && Objects.equals(this.originalTitle, boxSetInfo.originalTitle)
                && Objects.equals(this.path, boxSetInfo.path)
                && Objects.equals(this.metadataLanguage, boxSetInfo.metadataLanguage)
                && Objects.equals(this.metadataCountryCode, boxSetInfo.metadataCountryCode)
                && Objects.equals(this.providerIds, boxSetInfo.providerIds)
                && Objects.equals(this.year, boxSetInfo.year)
                && Objects.equals(this.indexNumber, boxSetInfo.indexNumber)
                && Objects.equals(this.parentIndexNumber, boxSetInfo.parentIndexNumber)
                && Objects.equals(this.premiereDate, boxSetInfo.premiereDate)
                && Objects.equals(this.isAutomated, boxSetInfo.isAutomated);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, originalTitle, path, metadataLanguage, metadataCountryCode, providerIds, year,
                indexNumber, parentIndexNumber, premiereDate, isAutomated);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class BoxSetInfo {\n");
        sb.append("    name: ").append(toIndentedString(name)).append("\n");
        sb.append("    originalTitle: ").append(toIndentedString(originalTitle)).append("\n");
        sb.append("    path: ").append(toIndentedString(path)).append("\n");
        sb.append("    metadataLanguage: ").append(toIndentedString(metadataLanguage)).append("\n");
        sb.append("    metadataCountryCode: ").append(toIndentedString(metadataCountryCode)).append("\n");
        sb.append("    providerIds: ").append(toIndentedString(providerIds)).append("\n");
        sb.append("    year: ").append(toIndentedString(year)).append("\n");
        sb.append("    indexNumber: ").append(toIndentedString(indexNumber)).append("\n");
        sb.append("    parentIndexNumber: ").append(toIndentedString(parentIndexNumber)).append("\n");
        sb.append("    premiereDate: ").append(toIndentedString(premiereDate)).append("\n");
        sb.append("    isAutomated: ").append(toIndentedString(isAutomated)).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 `Name` to the URL query string
        if (getName() != null) {
            try {
                joiner.add(String.format(java.util.Locale.ROOT, "%sName%s=%s", prefix, suffix,
                        URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20")));
            } catch (UnsupportedEncodingException e) {
                // Should never happen, UTF-8 is always supported
                throw new RuntimeException(e);
            }
        }

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

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

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

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

        // add `ProviderIds` to the URL query string
        if (getProviderIds() != null) {
            for (String _key : getProviderIds().keySet()) {
                try {
                    joiner.add(String.format(java.util.Locale.ROOT, "%sProviderIds%s%s=%s", prefix, suffix,
                            "".equals(suffix) ? ""
                                    : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, _key,
                                            containerSuffix),
                            getProviderIds().get(_key),
                            URLEncoder.encode(String.valueOf(getProviderIds().get(_key)), "UTF-8").replaceAll("\\+",
                                    "%20")));
                } catch (UnsupportedEncodingException e) {
                    // Should never happen, UTF-8 is always supported
                    throw new RuntimeException(e);
                }
            }
        }

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

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

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

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

        // add `IsAutomated` to the URL query string
        if (getIsAutomated() != null) {
            try {
                joiner.add(String.format(java.util.Locale.ROOT, "%sIsAutomated%s=%s", prefix, suffix,
                        URLEncoder.encode(String.valueOf(getIsAutomated()), "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 BoxSetInfo instance;

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

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

        public BoxSetInfo.Builder name(String name) {
            this.instance.name = name;
            return this;
        }

        public BoxSetInfo.Builder originalTitle(String originalTitle) {
            this.instance.originalTitle = originalTitle;
            return this;
        }

        public BoxSetInfo.Builder path(String path) {
            this.instance.path = path;
            return this;
        }

        public BoxSetInfo.Builder metadataLanguage(String metadataLanguage) {
            this.instance.metadataLanguage = metadataLanguage;
            return this;
        }

        public BoxSetInfo.Builder metadataCountryCode(String metadataCountryCode) {
            this.instance.metadataCountryCode = metadataCountryCode;
            return this;
        }

        public BoxSetInfo.Builder providerIds(Map<String, String> providerIds) {
            this.instance.providerIds = providerIds;
            return this;
        }

        public BoxSetInfo.Builder year(Integer year) {
            this.instance.year = year;
            return this;
        }

        public BoxSetInfo.Builder indexNumber(Integer indexNumber) {
            this.instance.indexNumber = indexNumber;
            return this;
        }

        public BoxSetInfo.Builder parentIndexNumber(Integer parentIndexNumber) {
            this.instance.parentIndexNumber = parentIndexNumber;
            return this;
        }

        public BoxSetInfo.Builder premiereDate(OffsetDateTime premiereDate) {
            this.instance.premiereDate = premiereDate;
            return this;
        }

        public BoxSetInfo.Builder isAutomated(Boolean isAutomated) {
            this.instance.isAutomated = isAutomated;
            return this;
        }

        /**
         * returns a built BoxSetInfo instance.
         *
         * The builder is not reusable.
         */
        public BoxSetInfo 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 BoxSetInfo.Builder builder() {
        return new BoxSetInfo.Builder();
    }

    /**
     * Create a builder with a shallow copy of this instance.
     */
    public BoxSetInfo.Builder toBuilder() {
        return new BoxSetInfo.Builder().name(getName()).originalTitle(getOriginalTitle()).path(getPath())
                .metadataLanguage(getMetadataLanguage()).metadataCountryCode(getMetadataCountryCode())
                .providerIds(getProviderIds()).year(getYear()).indexNumber(getIndexNumber())
                .parentIndexNumber(getParentIndexNumber()).premiereDate(getPremiereDate())
                .isAutomated(getIsAutomated());
    }
}
