/*
 * 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 java.util.UUID;

import com.fasterxml.jackson.annotation.JsonProperty;

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

    public static final String JSON_PROPERTY_ENABLE_IN_MAIN_MENU = "EnableInMainMenu";
    private @org.eclipse.jdt.annotation.Nullable Boolean enableInMainMenu;

    public static final String JSON_PROPERTY_MENU_SECTION = "MenuSection";
    private @org.eclipse.jdt.annotation.Nullable String menuSection;

    public static final String JSON_PROPERTY_MENU_ICON = "MenuIcon";
    private @org.eclipse.jdt.annotation.Nullable String menuIcon;

    public static final String JSON_PROPERTY_DISPLAY_NAME = "DisplayName";
    private @org.eclipse.jdt.annotation.Nullable String displayName;

    public static final String JSON_PROPERTY_PLUGIN_ID = "PluginId";
    private @org.eclipse.jdt.annotation.Nullable UUID pluginId;

    public ConfigurationPageInfo() {
    }

    public ConfigurationPageInfo 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 ConfigurationPageInfo enableInMainMenu(@org.eclipse.jdt.annotation.Nullable Boolean enableInMainMenu) {
        this.enableInMainMenu = enableInMainMenu;
        return this;
    }

    /**
     * Gets or sets a value indicating whether the configurations page is enabled in the main menu.
     * 
     * @return enableInMainMenu
     */
    @JsonProperty(value = JSON_PROPERTY_ENABLE_IN_MAIN_MENU)
    public @org.eclipse.jdt.annotation.Nullable Boolean getEnableInMainMenu() {
        return enableInMainMenu;
    }

    @JsonProperty(value = JSON_PROPERTY_ENABLE_IN_MAIN_MENU)
    public void setEnableInMainMenu(@org.eclipse.jdt.annotation.Nullable Boolean enableInMainMenu) {
        this.enableInMainMenu = enableInMainMenu;
    }

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

    /**
     * Gets or sets the menu section.
     * 
     * @return menuSection
     */
    @JsonProperty(value = JSON_PROPERTY_MENU_SECTION)
    public @org.eclipse.jdt.annotation.Nullable String getMenuSection() {
        return menuSection;
    }

    @JsonProperty(value = JSON_PROPERTY_MENU_SECTION)
    public void setMenuSection(@org.eclipse.jdt.annotation.Nullable String menuSection) {
        this.menuSection = menuSection;
    }

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

    /**
     * Gets or sets the menu icon.
     * 
     * @return menuIcon
     */
    @JsonProperty(value = JSON_PROPERTY_MENU_ICON)
    public @org.eclipse.jdt.annotation.Nullable String getMenuIcon() {
        return menuIcon;
    }

    @JsonProperty(value = JSON_PROPERTY_MENU_ICON)
    public void setMenuIcon(@org.eclipse.jdt.annotation.Nullable String menuIcon) {
        this.menuIcon = menuIcon;
    }

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

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

    @JsonProperty(value = JSON_PROPERTY_DISPLAY_NAME)
    public void setDisplayName(@org.eclipse.jdt.annotation.Nullable String displayName) {
        this.displayName = displayName;
    }

    public ConfigurationPageInfo pluginId(@org.eclipse.jdt.annotation.Nullable UUID pluginId) {
        this.pluginId = pluginId;
        return this;
    }

    /**
     * Gets or sets the plugin id.
     * 
     * @return pluginId
     */
    @JsonProperty(value = JSON_PROPERTY_PLUGIN_ID)
    public @org.eclipse.jdt.annotation.Nullable UUID getPluginId() {
        return pluginId;
    }

    @JsonProperty(value = JSON_PROPERTY_PLUGIN_ID)
    public void setPluginId(@org.eclipse.jdt.annotation.Nullable UUID pluginId) {
        this.pluginId = pluginId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ConfigurationPageInfo configurationPageInfo = (ConfigurationPageInfo) o;
        return Objects.equals(this.name, configurationPageInfo.name)
                && Objects.equals(this.enableInMainMenu, configurationPageInfo.enableInMainMenu)
                && Objects.equals(this.menuSection, configurationPageInfo.menuSection)
                && Objects.equals(this.menuIcon, configurationPageInfo.menuIcon)
                && Objects.equals(this.displayName, configurationPageInfo.displayName)
                && Objects.equals(this.pluginId, configurationPageInfo.pluginId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, enableInMainMenu, menuSection, menuIcon, displayName, pluginId);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class ConfigurationPageInfo {\n");
        sb.append("    name: ").append(toIndentedString(name)).append("\n");
        sb.append("    enableInMainMenu: ").append(toIndentedString(enableInMainMenu)).append("\n");
        sb.append("    menuSection: ").append(toIndentedString(menuSection)).append("\n");
        sb.append("    menuIcon: ").append(toIndentedString(menuIcon)).append("\n");
        sb.append("    displayName: ").append(toIndentedString(displayName)).append("\n");
        sb.append("    pluginId: ").append(toIndentedString(pluginId)).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 `EnableInMainMenu` to the URL query string
        if (getEnableInMainMenu() != null) {
            try {
                joiner.add(String.format(java.util.Locale.ROOT, "%sEnableInMainMenu%s=%s", prefix, suffix,
                        URLEncoder.encode(String.valueOf(getEnableInMainMenu()), "UTF-8").replaceAll("\\+", "%20")));
            } catch (UnsupportedEncodingException e) {
                // Should never happen, UTF-8 is always supported
                throw new RuntimeException(e);
            }
        }

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

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

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

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

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

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

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

        public ConfigurationPageInfo.Builder enableInMainMenu(Boolean enableInMainMenu) {
            this.instance.enableInMainMenu = enableInMainMenu;
            return this;
        }

        public ConfigurationPageInfo.Builder menuSection(String menuSection) {
            this.instance.menuSection = menuSection;
            return this;
        }

        public ConfigurationPageInfo.Builder menuIcon(String menuIcon) {
            this.instance.menuIcon = menuIcon;
            return this;
        }

        public ConfigurationPageInfo.Builder displayName(String displayName) {
            this.instance.displayName = displayName;
            return this;
        }

        public ConfigurationPageInfo.Builder pluginId(UUID pluginId) {
            this.instance.pluginId = pluginId;
            return this;
        }

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

    /**
     * Create a builder with a shallow copy of this instance.
     */
    public ConfigurationPageInfo.Builder toBuilder() {
        return new ConfigurationPageInfo.Builder().name(getName()).enableInMainMenu(getEnableInMainMenu())
                .menuSection(getMenuSection()).menuIcon(getMenuIcon()).displayName(getDisplayName())
                .pluginId(getPluginId());
    }
}
