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

/**
 * Class RemoteImageInfo.
 */
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "OpenAPI Generator")
public class RemoteImageInfo {
    public static final String JSON_PROPERTY_PROVIDER_NAME = "ProviderName";
    private @org.eclipse.jdt.annotation.Nullable String providerName;

    public static final String JSON_PROPERTY_URL = "Url";
    private @org.eclipse.jdt.annotation.Nullable String url;

    public static final String JSON_PROPERTY_THUMBNAIL_URL = "ThumbnailUrl";
    private @org.eclipse.jdt.annotation.Nullable String thumbnailUrl;

    public static final String JSON_PROPERTY_HEIGHT = "Height";
    private @org.eclipse.jdt.annotation.Nullable Integer height;

    public static final String JSON_PROPERTY_WIDTH = "Width";
    private @org.eclipse.jdt.annotation.Nullable Integer width;

    public static final String JSON_PROPERTY_COMMUNITY_RATING = "CommunityRating";
    private @org.eclipse.jdt.annotation.Nullable Double communityRating;

    public static final String JSON_PROPERTY_VOTE_COUNT = "VoteCount";
    private @org.eclipse.jdt.annotation.Nullable Integer voteCount;

    public static final String JSON_PROPERTY_LANGUAGE = "Language";
    private @org.eclipse.jdt.annotation.Nullable String language;

    public static final String JSON_PROPERTY_TYPE = "Type";
    private @org.eclipse.jdt.annotation.Nullable ImageType type;

    public static final String JSON_PROPERTY_RATING_TYPE = "RatingType";
    private @org.eclipse.jdt.annotation.Nullable RatingType ratingType;

    public RemoteImageInfo() {
    }

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

    /**
     * Gets or sets the name of the provider.
     * 
     * @return providerName
     */
    @JsonProperty(value = JSON_PROPERTY_PROVIDER_NAME)
    public @org.eclipse.jdt.annotation.Nullable String getProviderName() {
        return providerName;
    }

    @JsonProperty(value = JSON_PROPERTY_PROVIDER_NAME)
    public void setProviderName(@org.eclipse.jdt.annotation.Nullable String providerName) {
        this.providerName = providerName;
    }

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

    /**
     * Gets or sets the URL.
     * 
     * @return url
     */
    @JsonProperty(value = JSON_PROPERTY_URL)
    public @org.eclipse.jdt.annotation.Nullable String getUrl() {
        return url;
    }

    @JsonProperty(value = JSON_PROPERTY_URL)
    public void setUrl(@org.eclipse.jdt.annotation.Nullable String url) {
        this.url = url;
    }

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

    /**
     * Gets or sets a url used for previewing a smaller version.
     * 
     * @return thumbnailUrl
     */
    @JsonProperty(value = JSON_PROPERTY_THUMBNAIL_URL)
    public @org.eclipse.jdt.annotation.Nullable String getThumbnailUrl() {
        return thumbnailUrl;
    }

    @JsonProperty(value = JSON_PROPERTY_THUMBNAIL_URL)
    public void setThumbnailUrl(@org.eclipse.jdt.annotation.Nullable String thumbnailUrl) {
        this.thumbnailUrl = thumbnailUrl;
    }

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

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

    @JsonProperty(value = JSON_PROPERTY_HEIGHT)
    public void setHeight(@org.eclipse.jdt.annotation.Nullable Integer height) {
        this.height = height;
    }

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

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

    @JsonProperty(value = JSON_PROPERTY_WIDTH)
    public void setWidth(@org.eclipse.jdt.annotation.Nullable Integer width) {
        this.width = width;
    }

    public RemoteImageInfo communityRating(@org.eclipse.jdt.annotation.Nullable Double communityRating) {
        this.communityRating = communityRating;
        return this;
    }

    /**
     * Gets or sets the community rating.
     * 
     * @return communityRating
     */
    @JsonProperty(value = JSON_PROPERTY_COMMUNITY_RATING)
    public @org.eclipse.jdt.annotation.Nullable Double getCommunityRating() {
        return communityRating;
    }

    @JsonProperty(value = JSON_PROPERTY_COMMUNITY_RATING)
    public void setCommunityRating(@org.eclipse.jdt.annotation.Nullable Double communityRating) {
        this.communityRating = communityRating;
    }

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

    /**
     * Gets or sets the vote count.
     * 
     * @return voteCount
     */
    @JsonProperty(value = JSON_PROPERTY_VOTE_COUNT)
    public @org.eclipse.jdt.annotation.Nullable Integer getVoteCount() {
        return voteCount;
    }

    @JsonProperty(value = JSON_PROPERTY_VOTE_COUNT)
    public void setVoteCount(@org.eclipse.jdt.annotation.Nullable Integer voteCount) {
        this.voteCount = voteCount;
    }

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

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

    @JsonProperty(value = JSON_PROPERTY_LANGUAGE)
    public void setLanguage(@org.eclipse.jdt.annotation.Nullable String language) {
        this.language = language;
    }

    public RemoteImageInfo type(@org.eclipse.jdt.annotation.Nullable ImageType type) {
        this.type = type;
        return this;
    }

    /**
     * Gets or sets the type.
     * 
     * @return type
     */
    @JsonProperty(value = JSON_PROPERTY_TYPE)
    public @org.eclipse.jdt.annotation.Nullable ImageType getType() {
        return type;
    }

    @JsonProperty(value = JSON_PROPERTY_TYPE)
    public void setType(@org.eclipse.jdt.annotation.Nullable ImageType type) {
        this.type = type;
    }

    public RemoteImageInfo ratingType(@org.eclipse.jdt.annotation.Nullable RatingType ratingType) {
        this.ratingType = ratingType;
        return this;
    }

    /**
     * Gets or sets the type of the rating.
     * 
     * @return ratingType
     */
    @JsonProperty(value = JSON_PROPERTY_RATING_TYPE)
    public @org.eclipse.jdt.annotation.Nullable RatingType getRatingType() {
        return ratingType;
    }

    @JsonProperty(value = JSON_PROPERTY_RATING_TYPE)
    public void setRatingType(@org.eclipse.jdt.annotation.Nullable RatingType ratingType) {
        this.ratingType = ratingType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        RemoteImageInfo remoteImageInfo = (RemoteImageInfo) o;
        return Objects.equals(this.providerName, remoteImageInfo.providerName)
                && Objects.equals(this.url, remoteImageInfo.url)
                && Objects.equals(this.thumbnailUrl, remoteImageInfo.thumbnailUrl)
                && Objects.equals(this.height, remoteImageInfo.height)
                && Objects.equals(this.width, remoteImageInfo.width)
                && Objects.equals(this.communityRating, remoteImageInfo.communityRating)
                && Objects.equals(this.voteCount, remoteImageInfo.voteCount)
                && Objects.equals(this.language, remoteImageInfo.language)
                && Objects.equals(this.type, remoteImageInfo.type)
                && Objects.equals(this.ratingType, remoteImageInfo.ratingType);
    }

    @Override
    public int hashCode() {
        return Objects.hash(providerName, url, thumbnailUrl, height, width, communityRating, voteCount, language, type,
                ratingType);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class RemoteImageInfo {\n");
        sb.append("    providerName: ").append(toIndentedString(providerName)).append("\n");
        sb.append("    url: ").append(toIndentedString(url)).append("\n");
        sb.append("    thumbnailUrl: ").append(toIndentedString(thumbnailUrl)).append("\n");
        sb.append("    height: ").append(toIndentedString(height)).append("\n");
        sb.append("    width: ").append(toIndentedString(width)).append("\n");
        sb.append("    communityRating: ").append(toIndentedString(communityRating)).append("\n");
        sb.append("    voteCount: ").append(toIndentedString(voteCount)).append("\n");
        sb.append("    language: ").append(toIndentedString(language)).append("\n");
        sb.append("    type: ").append(toIndentedString(type)).append("\n");
        sb.append("    ratingType: ").append(toIndentedString(ratingType)).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 `ProviderName` to the URL query string
        if (getProviderName() != null) {
            try {
                joiner.add(String.format(java.util.Locale.ROOT, "%sProviderName%s=%s", prefix, suffix,
                        URLEncoder.encode(String.valueOf(getProviderName()), "UTF-8").replaceAll("\\+", "%20")));
            } catch (UnsupportedEncodingException e) {
                // Should never happen, UTF-8 is always supported
                throw new RuntimeException(e);
            }
        }

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

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

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

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

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

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

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

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

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

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

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

        public RemoteImageInfo.Builder providerName(String providerName) {
            this.instance.providerName = providerName;
            return this;
        }

        public RemoteImageInfo.Builder url(String url) {
            this.instance.url = url;
            return this;
        }

        public RemoteImageInfo.Builder thumbnailUrl(String thumbnailUrl) {
            this.instance.thumbnailUrl = thumbnailUrl;
            return this;
        }

        public RemoteImageInfo.Builder height(Integer height) {
            this.instance.height = height;
            return this;
        }

        public RemoteImageInfo.Builder width(Integer width) {
            this.instance.width = width;
            return this;
        }

        public RemoteImageInfo.Builder communityRating(Double communityRating) {
            this.instance.communityRating = communityRating;
            return this;
        }

        public RemoteImageInfo.Builder voteCount(Integer voteCount) {
            this.instance.voteCount = voteCount;
            return this;
        }

        public RemoteImageInfo.Builder language(String language) {
            this.instance.language = language;
            return this;
        }

        public RemoteImageInfo.Builder type(ImageType type) {
            this.instance.type = type;
            return this;
        }

        public RemoteImageInfo.Builder ratingType(RatingType ratingType) {
            this.instance.ratingType = ratingType;
            return this;
        }

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

    /**
     * Create a builder with a shallow copy of this instance.
     */
    public RemoteImageInfo.Builder toBuilder() {
        return new RemoteImageInfo.Builder().providerName(getProviderName()).url(getUrl())
                .thumbnailUrl(getThumbnailUrl()).height(getHeight()).width(getWidth())
                .communityRating(getCommunityRating()).voteCount(getVoteCount()).language(getLanguage()).type(getType())
                .ratingType(getRatingType());
    }
}
