/*
 * 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;

/**
 * MovieInfo
 */
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "OpenAPI Generator")
public class MovieInfo {
    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 MovieInfo() {
    }

    public MovieInfo 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 MovieInfo 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 MovieInfo 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 MovieInfo 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 MovieInfo 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 MovieInfo providerIds(@org.eclipse.jdt.annotation.Nullable Map<String, String> providerIds) {
        this.providerIds = providerIds;
        return this;
    }

    public MovieInfo 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 MovieInfo 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 MovieInfo 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 MovieInfo 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 MovieInfo 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 MovieInfo 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;
        }
        MovieInfo movieInfo = (MovieInfo) o;
        return Objects.equals(this.name, movieInfo.name) && Objects.equals(this.originalTitle, movieInfo.originalTitle)
                && Objects.equals(this.path, movieInfo.path)
                && Objects.equals(this.metadataLanguage, movieInfo.metadataLanguage)
                && Objects.equals(this.metadataCountryCode, movieInfo.metadataCountryCode)
                && Objects.equals(this.providerIds, movieInfo.providerIds) && Objects.equals(this.year, movieInfo.year)
                && Objects.equals(this.indexNumber, movieInfo.indexNumber)
                && Objects.equals(this.parentIndexNumber, movieInfo.parentIndexNumber)
                && Objects.equals(this.premiereDate, movieInfo.premiereDate)
                && Objects.equals(this.isAutomated, movieInfo.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 MovieInfo {\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 MovieInfo instance;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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