/**
 *
 * Please note:
 * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * Do not edit this file manually.
 *
 */
package com.gravatar.restapi.models

import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import java.util.Objects

/**
 * An error response from the API.
 *
 * @param error The error message
 * @param code The error code for the error message
 */
@JsonClass(generateAdapter = true)
public class Error internal constructor(
    // The error message
    @Json(name = "error")
    public val error: kotlin.String,
    // The error code for the error message
    @Json(name = "code")
    public val code: kotlin.String? = null,
) {
    override fun toString(): String = "Error(error=$error, code=$code)"

    override fun equals(other: Any?): Boolean = other is Error &&
        error == other.error &&
        code == other.code

    override fun hashCode(): Int = Objects.hash(error, code)

    public class Builder {
        // The error message
        @set:JvmSynthetic // Hide 'void' setter from Java
        public var error: kotlin.String? = null

        // The error code for the error message
        @set:JvmSynthetic // Hide 'void' setter from Java
        public var code: kotlin.String? = null

        public fun setError(error: kotlin.String?): Builder = apply { this.error = error }

        public fun setCode(code: kotlin.String?): Builder = apply { this.code = code }

        public fun build(): Error = Error(error!!, code)
    }
}

@JvmSynthetic // Hide from Java callers who should use Builder.
public fun Error(initializer: Error.Builder.() -> Unit): Error {
    return Error.Builder().apply(initializer).build()
}
