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

/**
 * The languages the user knows. This is only provided in authenticated API requests.
 *
 * @param code The language code.
 * @param name The language name.
 * @param isPrimary Whether the language is the user's primary language.
 * @param order The order of the language in the user's profile.
 */
@JsonClass(generateAdapter = true)
public class Language internal constructor(
    // The language code.
    @Json(name = "code")
    public val code: kotlin.String,
    // The language name.
    @Json(name = "name")
    public val name: kotlin.String,
    // Whether the language is the user's primary language.
    @Json(name = "is_primary")
    public val isPrimary: kotlin.Boolean,
    // The order of the language in the user's profile.
    @Json(name = "order")
    public val order: kotlin.Int,
) {
    override fun toString(): String = "Language(code=$code, name=$name, isPrimary=$isPrimary, order=$order)"

    override fun equals(other: Any?): Boolean = other is Language &&
        code == other.code &&
        name == other.name &&
        isPrimary == other.isPrimary &&
        order == other.order

    override fun hashCode(): Int = Objects.hash(code, name, isPrimary, order)

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

        // The language name.
        @set:JvmSynthetic // Hide 'void' setter from Java
        public var name: kotlin.String? = null

        // Whether the language is the user's primary language.
        @set:JvmSynthetic // Hide 'void' setter from Java
        public var isPrimary: kotlin.Boolean? = null

        // The order of the language in the user's profile.
        @set:JvmSynthetic // Hide 'void' setter from Java
        public var order: kotlin.Int? = null

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

        public fun setName(name: kotlin.String?): Builder = apply { this.name = name }

        public fun setIsPrimary(isPrimary: kotlin.Boolean?): Builder = apply { this.isPrimary = isPrimary }

        public fun setOrder(order: kotlin.Int?): Builder = apply { this.order = order }

        public fun build(): Language = Language(code!!, name!!, isPrimary!!, order!!)
    }
}

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