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

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * An activity log entry.
 */
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "OpenAPI Generator")
public class ActivityLogEntry {
    public static final String JSON_PROPERTY_ID = "Id";
    private @org.eclipse.jdt.annotation.Nullable Long id;

    public static final String JSON_PROPERTY_NAME = "Name";
    private @org.eclipse.jdt.annotation.Nullable String name;

    public static final String JSON_PROPERTY_OVERVIEW = "Overview";
    private @org.eclipse.jdt.annotation.Nullable String overview;

    public static final String JSON_PROPERTY_SHORT_OVERVIEW = "ShortOverview";
    private @org.eclipse.jdt.annotation.Nullable String shortOverview;

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

    public static final String JSON_PROPERTY_ITEM_ID = "ItemId";
    private @org.eclipse.jdt.annotation.Nullable String itemId;

    public static final String JSON_PROPERTY_DATE = "Date";
    private @org.eclipse.jdt.annotation.Nullable OffsetDateTime date;

    public static final String JSON_PROPERTY_USER_ID = "UserId";
    private @org.eclipse.jdt.annotation.Nullable UUID userId;

    public static final String JSON_PROPERTY_USER_PRIMARY_IMAGE_TAG = "UserPrimaryImageTag";
    private @org.eclipse.jdt.annotation.Nullable String userPrimaryImageTag;

    public static final String JSON_PROPERTY_SEVERITY = "Severity";
    private @org.eclipse.jdt.annotation.Nullable LogLevel severity;

    public ActivityLogEntry() {
    }

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

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

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

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

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

    @JsonProperty(value = JSON_PROPERTY_OVERVIEW)
    public void setOverview(@org.eclipse.jdt.annotation.Nullable String overview) {
        this.overview = overview;
    }

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

    /**
     * Gets or sets the short overview.
     * 
     * @return shortOverview
     */
    @JsonProperty(value = JSON_PROPERTY_SHORT_OVERVIEW)
    public @org.eclipse.jdt.annotation.Nullable String getShortOverview() {
        return shortOverview;
    }

    @JsonProperty(value = JSON_PROPERTY_SHORT_OVERVIEW)
    public void setShortOverview(@org.eclipse.jdt.annotation.Nullable String shortOverview) {
        this.shortOverview = shortOverview;
    }

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

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

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

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

    /**
     * Gets or sets the item identifier.
     * 
     * @return itemId
     */
    @JsonProperty(value = JSON_PROPERTY_ITEM_ID)
    public @org.eclipse.jdt.annotation.Nullable String getItemId() {
        return itemId;
    }

    @JsonProperty(value = JSON_PROPERTY_ITEM_ID)
    public void setItemId(@org.eclipse.jdt.annotation.Nullable String itemId) {
        this.itemId = itemId;
    }

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

    /**
     * Gets or sets the date.
     * 
     * @return date
     */
    @JsonProperty(value = JSON_PROPERTY_DATE)
    public @org.eclipse.jdt.annotation.Nullable OffsetDateTime getDate() {
        return date;
    }

    @JsonProperty(value = JSON_PROPERTY_DATE)
    public void setDate(@org.eclipse.jdt.annotation.Nullable OffsetDateTime date) {
        this.date = date;
    }

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

    /**
     * Gets or sets the user identifier.
     * 
     * @return userId
     */
    @JsonProperty(value = JSON_PROPERTY_USER_ID)
    public @org.eclipse.jdt.annotation.Nullable UUID getUserId() {
        return userId;
    }

    @JsonProperty(value = JSON_PROPERTY_USER_ID)
    public void setUserId(@org.eclipse.jdt.annotation.Nullable UUID userId) {
        this.userId = userId;
    }

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

    /**
     * Gets or sets the user primary image tag.
     * 
     * @return userPrimaryImageTag
     * @deprecated
     */
    @Deprecated
    @JsonProperty(value = JSON_PROPERTY_USER_PRIMARY_IMAGE_TAG)
    public @org.eclipse.jdt.annotation.Nullable String getUserPrimaryImageTag() {
        return userPrimaryImageTag;
    }

    @JsonProperty(value = JSON_PROPERTY_USER_PRIMARY_IMAGE_TAG)
    public void setUserPrimaryImageTag(@org.eclipse.jdt.annotation.Nullable String userPrimaryImageTag) {
        this.userPrimaryImageTag = userPrimaryImageTag;
    }

    public ActivityLogEntry severity(@org.eclipse.jdt.annotation.Nullable LogLevel severity) {
        this.severity = severity;
        return this;
    }

    /**
     * Gets or sets the log severity.
     * 
     * @return severity
     */
    @JsonProperty(value = JSON_PROPERTY_SEVERITY)
    public @org.eclipse.jdt.annotation.Nullable LogLevel getSeverity() {
        return severity;
    }

    @JsonProperty(value = JSON_PROPERTY_SEVERITY)
    public void setSeverity(@org.eclipse.jdt.annotation.Nullable LogLevel severity) {
        this.severity = severity;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ActivityLogEntry activityLogEntry = (ActivityLogEntry) o;
        return Objects.equals(this.id, activityLogEntry.id) && Objects.equals(this.name, activityLogEntry.name)
                && Objects.equals(this.overview, activityLogEntry.overview)
                && Objects.equals(this.shortOverview, activityLogEntry.shortOverview)
                && Objects.equals(this.type, activityLogEntry.type)
                && Objects.equals(this.itemId, activityLogEntry.itemId)
                && Objects.equals(this.date, activityLogEntry.date)
                && Objects.equals(this.userId, activityLogEntry.userId)
                && Objects.equals(this.userPrimaryImageTag, activityLogEntry.userPrimaryImageTag)
                && Objects.equals(this.severity, activityLogEntry.severity);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, overview, shortOverview, type, itemId, date, userId, userPrimaryImageTag,
                severity);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class ActivityLogEntry {\n");
        sb.append("    id: ").append(toIndentedString(id)).append("\n");
        sb.append("    name: ").append(toIndentedString(name)).append("\n");
        sb.append("    overview: ").append(toIndentedString(overview)).append("\n");
        sb.append("    shortOverview: ").append(toIndentedString(shortOverview)).append("\n");
        sb.append("    type: ").append(toIndentedString(type)).append("\n");
        sb.append("    itemId: ").append(toIndentedString(itemId)).append("\n");
        sb.append("    date: ").append(toIndentedString(date)).append("\n");
        sb.append("    userId: ").append(toIndentedString(userId)).append("\n");
        sb.append("    userPrimaryImageTag: ").append(toIndentedString(userPrimaryImageTag)).append("\n");
        sb.append("    severity: ").append(toIndentedString(severity)).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 `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 `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 `Overview` to the URL query string
        if (getOverview() != null) {
            try {
                joiner.add(String.format(java.util.Locale.ROOT, "%sOverview%s=%s", prefix, suffix,
                        URLEncoder.encode(String.valueOf(getOverview()), "UTF-8").replaceAll("\\+", "%20")));
            } catch (UnsupportedEncodingException e) {
                // Should never happen, UTF-8 is always supported
                throw new RuntimeException(e);
            }
        }

        // add `ShortOverview` to the URL query string
        if (getShortOverview() != null) {
            try {
                joiner.add(String.format(java.util.Locale.ROOT, "%sShortOverview%s=%s", prefix, suffix,
                        URLEncoder.encode(String.valueOf(getShortOverview()), "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 `ItemId` to the URL query string
        if (getItemId() != null) {
            try {
                joiner.add(String.format(java.util.Locale.ROOT, "%sItemId%s=%s", prefix, suffix,
                        URLEncoder.encode(String.valueOf(getItemId()), "UTF-8").replaceAll("\\+", "%20")));
            } catch (UnsupportedEncodingException e) {
                // Should never happen, UTF-8 is always supported
                throw new RuntimeException(e);
            }
        }

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

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

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

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

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

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

        public ActivityLogEntry.Builder id(Long id) {
            this.instance.id = id;
            return this;
        }

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

        public ActivityLogEntry.Builder overview(String overview) {
            this.instance.overview = overview;
            return this;
        }

        public ActivityLogEntry.Builder shortOverview(String shortOverview) {
            this.instance.shortOverview = shortOverview;
            return this;
        }

        public ActivityLogEntry.Builder type(String type) {
            this.instance.type = type;
            return this;
        }

        public ActivityLogEntry.Builder itemId(String itemId) {
            this.instance.itemId = itemId;
            return this;
        }

        public ActivityLogEntry.Builder date(OffsetDateTime date) {
            this.instance.date = date;
            return this;
        }

        public ActivityLogEntry.Builder userId(UUID userId) {
            this.instance.userId = userId;
            return this;
        }

        public ActivityLogEntry.Builder userPrimaryImageTag(String userPrimaryImageTag) {
            this.instance.userPrimaryImageTag = userPrimaryImageTag;
            return this;
        }

        public ActivityLogEntry.Builder severity(LogLevel severity) {
            this.instance.severity = severity;
            return this;
        }

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

    /**
     * Create a builder with a shallow copy of this instance.
     */
    public ActivityLogEntry.Builder toBuilder() {
        return new ActivityLogEntry.Builder().id(getId()).name(getName()).overview(getOverview())
                .shortOverview(getShortOverview()).type(getType()).itemId(getItemId()).date(getDate())
                .userId(getUserId()).userPrimaryImageTag(getUserPrimaryImageTag()).severity(getSeverity());
    }
}
