// File generated from our OpenAPI spec by Stainless.

package com.increase.api.models.cardpayments

import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
import com.increase.api.core.Enum
import com.increase.api.core.ExcludeMissing
import com.increase.api.core.JsonField
import com.increase.api.core.JsonMissing
import com.increase.api.core.JsonValue
import com.increase.api.core.checkKnown
import com.increase.api.core.checkRequired
import com.increase.api.core.toImmutable
import com.increase.api.errors.IncreaseInvalidDataException
import java.time.LocalDate
import java.time.OffsetDateTime
import java.util.Collections
import java.util.Objects
import java.util.Optional
import kotlin.jvm.optionals.getOrNull

/**
 * Card Payments group together interactions related to a single card payment, such as an
 * authorization and its corresponding settlement.
 */
class CardPayment
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
    private val id: JsonField<String>,
    private val accountId: JsonField<String>,
    private val cardId: JsonField<String>,
    private val createdAt: JsonField<OffsetDateTime>,
    private val digitalWalletTokenId: JsonField<String>,
    private val elements: JsonField<List<Element>>,
    private val physicalCardId: JsonField<String>,
    private val state: JsonField<State>,
    private val type: JsonField<Type>,
    private val additionalProperties: MutableMap<String, JsonValue>,
) {

    @JsonCreator
    private constructor(
        @JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
        @JsonProperty("account_id") @ExcludeMissing accountId: JsonField<String> = JsonMissing.of(),
        @JsonProperty("card_id") @ExcludeMissing cardId: JsonField<String> = JsonMissing.of(),
        @JsonProperty("created_at")
        @ExcludeMissing
        createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
        @JsonProperty("digital_wallet_token_id")
        @ExcludeMissing
        digitalWalletTokenId: JsonField<String> = JsonMissing.of(),
        @JsonProperty("elements")
        @ExcludeMissing
        elements: JsonField<List<Element>> = JsonMissing.of(),
        @JsonProperty("physical_card_id")
        @ExcludeMissing
        physicalCardId: JsonField<String> = JsonMissing.of(),
        @JsonProperty("state") @ExcludeMissing state: JsonField<State> = JsonMissing.of(),
        @JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
    ) : this(
        id,
        accountId,
        cardId,
        createdAt,
        digitalWalletTokenId,
        elements,
        physicalCardId,
        state,
        type,
        mutableMapOf(),
    )

    /**
     * The Card Payment identifier.
     *
     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
     *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
     */
    fun id(): String = id.getRequired("id")

    /**
     * The identifier for the Account the Transaction belongs to.
     *
     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
     *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
     */
    fun accountId(): String = accountId.getRequired("account_id")

    /**
     * The Card identifier for this payment.
     *
     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
     *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
     */
    fun cardId(): String = cardId.getRequired("card_id")

    /**
     * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Card Payment was
     * created.
     *
     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
     *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
     */
    fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")

    /**
     * The Digital Wallet Token identifier for this payment.
     *
     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the
     *   server responded with an unexpected value).
     */
    fun digitalWalletTokenId(): Optional<String> =
        digitalWalletTokenId.getOptional("digital_wallet_token_id")

    /**
     * The interactions related to this card payment.
     *
     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
     *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
     */
    fun elements(): List<Element> = elements.getRequired("elements")

    /**
     * The Physical Card identifier for this payment.
     *
     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the
     *   server responded with an unexpected value).
     */
    fun physicalCardId(): Optional<String> = physicalCardId.getOptional("physical_card_id")

    /**
     * The summarized state of this card payment.
     *
     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
     *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
     */
    fun state(): State = state.getRequired("state")

    /**
     * A constant representing the object's type. For this resource it will always be
     * `card_payment`.
     *
     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
     *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
     */
    fun type(): Type = type.getRequired("type")

    /**
     * Returns the raw JSON value of [id].
     *
     * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
     */
    @JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id

    /**
     * Returns the raw JSON value of [accountId].
     *
     * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type.
     */
    @JsonProperty("account_id") @ExcludeMissing fun _accountId(): JsonField<String> = accountId

    /**
     * Returns the raw JSON value of [cardId].
     *
     * Unlike [cardId], this method doesn't throw if the JSON field has an unexpected type.
     */
    @JsonProperty("card_id") @ExcludeMissing fun _cardId(): JsonField<String> = cardId

    /**
     * Returns the raw JSON value of [createdAt].
     *
     * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type.
     */
    @JsonProperty("created_at")
    @ExcludeMissing
    fun _createdAt(): JsonField<OffsetDateTime> = createdAt

    /**
     * Returns the raw JSON value of [digitalWalletTokenId].
     *
     * Unlike [digitalWalletTokenId], this method doesn't throw if the JSON field has an unexpected
     * type.
     */
    @JsonProperty("digital_wallet_token_id")
    @ExcludeMissing
    fun _digitalWalletTokenId(): JsonField<String> = digitalWalletTokenId

    /**
     * Returns the raw JSON value of [elements].
     *
     * Unlike [elements], this method doesn't throw if the JSON field has an unexpected type.
     */
    @JsonProperty("elements") @ExcludeMissing fun _elements(): JsonField<List<Element>> = elements

    /**
     * Returns the raw JSON value of [physicalCardId].
     *
     * Unlike [physicalCardId], this method doesn't throw if the JSON field has an unexpected type.
     */
    @JsonProperty("physical_card_id")
    @ExcludeMissing
    fun _physicalCardId(): JsonField<String> = physicalCardId

    /**
     * Returns the raw JSON value of [state].
     *
     * Unlike [state], this method doesn't throw if the JSON field has an unexpected type.
     */
    @JsonProperty("state") @ExcludeMissing fun _state(): JsonField<State> = state

    /**
     * Returns the raw JSON value of [type].
     *
     * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
     */
    @JsonProperty("type") @ExcludeMissing fun _type(): JsonField<Type> = type

    @JsonAnySetter
    private fun putAdditionalProperty(key: String, value: JsonValue) {
        additionalProperties.put(key, value)
    }

    @JsonAnyGetter
    @ExcludeMissing
    fun _additionalProperties(): Map<String, JsonValue> =
        Collections.unmodifiableMap(additionalProperties)

    fun toBuilder() = Builder().from(this)

    companion object {

        /**
         * Returns a mutable builder for constructing an instance of [CardPayment].
         *
         * The following fields are required:
         * ```java
         * .id()
         * .accountId()
         * .cardId()
         * .createdAt()
         * .digitalWalletTokenId()
         * .elements()
         * .physicalCardId()
         * .state()
         * .type()
         * ```
         */
        @JvmStatic fun builder() = Builder()
    }

    /** A builder for [CardPayment]. */
    class Builder internal constructor() {

        private var id: JsonField<String>? = null
        private var accountId: JsonField<String>? = null
        private var cardId: JsonField<String>? = null
        private var createdAt: JsonField<OffsetDateTime>? = null
        private var digitalWalletTokenId: JsonField<String>? = null
        private var elements: JsonField<MutableList<Element>>? = null
        private var physicalCardId: JsonField<String>? = null
        private var state: JsonField<State>? = null
        private var type: JsonField<Type>? = null
        private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

        @JvmSynthetic
        internal fun from(cardPayment: CardPayment) = apply {
            id = cardPayment.id
            accountId = cardPayment.accountId
            cardId = cardPayment.cardId
            createdAt = cardPayment.createdAt
            digitalWalletTokenId = cardPayment.digitalWalletTokenId
            elements = cardPayment.elements.map { it.toMutableList() }
            physicalCardId = cardPayment.physicalCardId
            state = cardPayment.state
            type = cardPayment.type
            additionalProperties = cardPayment.additionalProperties.toMutableMap()
        }

        /** The Card Payment identifier. */
        fun id(id: String) = id(JsonField.of(id))

        /**
         * Sets [Builder.id] to an arbitrary JSON value.
         *
         * You should usually call [Builder.id] with a well-typed [String] value instead. This
         * method is primarily for setting the field to an undocumented or not yet supported value.
         */
        fun id(id: JsonField<String>) = apply { this.id = id }

        /** The identifier for the Account the Transaction belongs to. */
        fun accountId(accountId: String) = accountId(JsonField.of(accountId))

        /**
         * Sets [Builder.accountId] to an arbitrary JSON value.
         *
         * You should usually call [Builder.accountId] with a well-typed [String] value instead.
         * This method is primarily for setting the field to an undocumented or not yet supported
         * value.
         */
        fun accountId(accountId: JsonField<String>) = apply { this.accountId = accountId }

        /** The Card identifier for this payment. */
        fun cardId(cardId: String) = cardId(JsonField.of(cardId))

        /**
         * Sets [Builder.cardId] to an arbitrary JSON value.
         *
         * You should usually call [Builder.cardId] with a well-typed [String] value instead. This
         * method is primarily for setting the field to an undocumented or not yet supported value.
         */
        fun cardId(cardId: JsonField<String>) = apply { this.cardId = cardId }

        /**
         * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Card Payment was
         * created.
         */
        fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt))

        /**
         * Sets [Builder.createdAt] to an arbitrary JSON value.
         *
         * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value
         * instead. This method is primarily for setting the field to an undocumented or not yet
         * supported value.
         */
        fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply { this.createdAt = createdAt }

        /** The Digital Wallet Token identifier for this payment. */
        fun digitalWalletTokenId(digitalWalletTokenId: String?) =
            digitalWalletTokenId(JsonField.ofNullable(digitalWalletTokenId))

        /**
         * Alias for calling [Builder.digitalWalletTokenId] with
         * `digitalWalletTokenId.orElse(null)`.
         */
        fun digitalWalletTokenId(digitalWalletTokenId: Optional<String>) =
            digitalWalletTokenId(digitalWalletTokenId.getOrNull())

        /**
         * Sets [Builder.digitalWalletTokenId] to an arbitrary JSON value.
         *
         * You should usually call [Builder.digitalWalletTokenId] with a well-typed [String] value
         * instead. This method is primarily for setting the field to an undocumented or not yet
         * supported value.
         */
        fun digitalWalletTokenId(digitalWalletTokenId: JsonField<String>) = apply {
            this.digitalWalletTokenId = digitalWalletTokenId
        }

        /** The interactions related to this card payment. */
        fun elements(elements: List<Element>) = elements(JsonField.of(elements))

        /**
         * Sets [Builder.elements] to an arbitrary JSON value.
         *
         * You should usually call [Builder.elements] with a well-typed `List<Element>` value
         * instead. This method is primarily for setting the field to an undocumented or not yet
         * supported value.
         */
        fun elements(elements: JsonField<List<Element>>) = apply {
            this.elements = elements.map { it.toMutableList() }
        }

        /**
         * Adds a single [Element] to [elements].
         *
         * @throws IllegalStateException if the field was previously set to a non-list.
         */
        fun addElement(element: Element) = apply {
            elements =
                (elements ?: JsonField.of(mutableListOf())).also {
                    checkKnown("elements", it).add(element)
                }
        }

        /** The Physical Card identifier for this payment. */
        fun physicalCardId(physicalCardId: String?) =
            physicalCardId(JsonField.ofNullable(physicalCardId))

        /** Alias for calling [Builder.physicalCardId] with `physicalCardId.orElse(null)`. */
        fun physicalCardId(physicalCardId: Optional<String>) =
            physicalCardId(physicalCardId.getOrNull())

        /**
         * Sets [Builder.physicalCardId] to an arbitrary JSON value.
         *
         * You should usually call [Builder.physicalCardId] with a well-typed [String] value
         * instead. This method is primarily for setting the field to an undocumented or not yet
         * supported value.
         */
        fun physicalCardId(physicalCardId: JsonField<String>) = apply {
            this.physicalCardId = physicalCardId
        }

        /** The summarized state of this card payment. */
        fun state(state: State) = state(JsonField.of(state))

        /**
         * Sets [Builder.state] to an arbitrary JSON value.
         *
         * You should usually call [Builder.state] with a well-typed [State] value instead. This
         * method is primarily for setting the field to an undocumented or not yet supported value.
         */
        fun state(state: JsonField<State>) = apply { this.state = state }

        /**
         * A constant representing the object's type. For this resource it will always be
         * `card_payment`.
         */
        fun type(type: Type) = type(JsonField.of(type))

        /**
         * Sets [Builder.type] to an arbitrary JSON value.
         *
         * You should usually call [Builder.type] with a well-typed [Type] value instead. This
         * method is primarily for setting the field to an undocumented or not yet supported value.
         */
        fun type(type: JsonField<Type>) = apply { this.type = type }

        fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
            this.additionalProperties.clear()
            putAllAdditionalProperties(additionalProperties)
        }

        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
            additionalProperties.put(key, value)
        }

        fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
            this.additionalProperties.putAll(additionalProperties)
        }

        fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }

        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
            keys.forEach(::removeAdditionalProperty)
        }

        /**
         * Returns an immutable instance of [CardPayment].
         *
         * Further updates to this [Builder] will not mutate the returned instance.
         *
         * The following fields are required:
         * ```java
         * .id()
         * .accountId()
         * .cardId()
         * .createdAt()
         * .digitalWalletTokenId()
         * .elements()
         * .physicalCardId()
         * .state()
         * .type()
         * ```
         *
         * @throws IllegalStateException if any required field is unset.
         */
        fun build(): CardPayment =
            CardPayment(
                checkRequired("id", id),
                checkRequired("accountId", accountId),
                checkRequired("cardId", cardId),
                checkRequired("createdAt", createdAt),
                checkRequired("digitalWalletTokenId", digitalWalletTokenId),
                checkRequired("elements", elements).map { it.toImmutable() },
                checkRequired("physicalCardId", physicalCardId),
                checkRequired("state", state),
                checkRequired("type", type),
                additionalProperties.toMutableMap(),
            )
    }

    private var validated: Boolean = false

    /**
     * Validates that the types of all values in this object match their expected types recursively.
     *
     * This method is _not_ forwards compatible with new types from the API for existing fields.
     *
     * @throws IncreaseInvalidDataException if any value type in this object doesn't match its
     *   expected type.
     */
    fun validate(): CardPayment = apply {
        if (validated) {
            return@apply
        }

        id()
        accountId()
        cardId()
        createdAt()
        digitalWalletTokenId()
        elements().forEach { it.validate() }
        physicalCardId()
        state().validate()
        type().validate()
        validated = true
    }

    fun isValid(): Boolean =
        try {
            validate()
            true
        } catch (e: IncreaseInvalidDataException) {
            false
        }

    /**
     * Returns a score indicating how many valid values are contained in this object recursively.
     *
     * Used for best match union deserialization.
     */
    @JvmSynthetic
    internal fun validity(): Int =
        (if (id.asKnown().isPresent) 1 else 0) +
            (if (accountId.asKnown().isPresent) 1 else 0) +
            (if (cardId.asKnown().isPresent) 1 else 0) +
            (if (createdAt.asKnown().isPresent) 1 else 0) +
            (if (digitalWalletTokenId.asKnown().isPresent) 1 else 0) +
            (elements.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
            (if (physicalCardId.asKnown().isPresent) 1 else 0) +
            (state.asKnown().getOrNull()?.validity() ?: 0) +
            (type.asKnown().getOrNull()?.validity() ?: 0)

    class Element
    @JsonCreator(mode = JsonCreator.Mode.DISABLED)
    private constructor(
        private val category: JsonField<Category>,
        private val createdAt: JsonField<OffsetDateTime>,
        private val cardAuthentication: JsonField<CardAuthentication>,
        private val cardAuthorization: JsonField<CardAuthorization>,
        private val cardAuthorizationExpiration: JsonField<CardAuthorizationExpiration>,
        private val cardBalanceInquiry: JsonField<CardBalanceInquiry>,
        private val cardDecline: JsonField<CardDecline>,
        private val cardFinancial: JsonField<CardFinancial>,
        private val cardFuelConfirmation: JsonField<CardFuelConfirmation>,
        private val cardIncrement: JsonField<CardIncrement>,
        private val cardRefund: JsonField<CardRefund>,
        private val cardReversal: JsonField<CardReversal>,
        private val cardSettlement: JsonField<CardSettlement>,
        private val cardValidation: JsonField<CardValidation>,
        private val other: JsonField<Other>,
        private val additionalProperties: MutableMap<String, JsonValue>,
    ) {

        @JsonCreator
        private constructor(
            @JsonProperty("category")
            @ExcludeMissing
            category: JsonField<Category> = JsonMissing.of(),
            @JsonProperty("created_at")
            @ExcludeMissing
            createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
            @JsonProperty("card_authentication")
            @ExcludeMissing
            cardAuthentication: JsonField<CardAuthentication> = JsonMissing.of(),
            @JsonProperty("card_authorization")
            @ExcludeMissing
            cardAuthorization: JsonField<CardAuthorization> = JsonMissing.of(),
            @JsonProperty("card_authorization_expiration")
            @ExcludeMissing
            cardAuthorizationExpiration: JsonField<CardAuthorizationExpiration> = JsonMissing.of(),
            @JsonProperty("card_balance_inquiry")
            @ExcludeMissing
            cardBalanceInquiry: JsonField<CardBalanceInquiry> = JsonMissing.of(),
            @JsonProperty("card_decline")
            @ExcludeMissing
            cardDecline: JsonField<CardDecline> = JsonMissing.of(),
            @JsonProperty("card_financial")
            @ExcludeMissing
            cardFinancial: JsonField<CardFinancial> = JsonMissing.of(),
            @JsonProperty("card_fuel_confirmation")
            @ExcludeMissing
            cardFuelConfirmation: JsonField<CardFuelConfirmation> = JsonMissing.of(),
            @JsonProperty("card_increment")
            @ExcludeMissing
            cardIncrement: JsonField<CardIncrement> = JsonMissing.of(),
            @JsonProperty("card_refund")
            @ExcludeMissing
            cardRefund: JsonField<CardRefund> = JsonMissing.of(),
            @JsonProperty("card_reversal")
            @ExcludeMissing
            cardReversal: JsonField<CardReversal> = JsonMissing.of(),
            @JsonProperty("card_settlement")
            @ExcludeMissing
            cardSettlement: JsonField<CardSettlement> = JsonMissing.of(),
            @JsonProperty("card_validation")
            @ExcludeMissing
            cardValidation: JsonField<CardValidation> = JsonMissing.of(),
            @JsonProperty("other") @ExcludeMissing other: JsonField<Other> = JsonMissing.of(),
        ) : this(
            category,
            createdAt,
            cardAuthentication,
            cardAuthorization,
            cardAuthorizationExpiration,
            cardBalanceInquiry,
            cardDecline,
            cardFinancial,
            cardFuelConfirmation,
            cardIncrement,
            cardRefund,
            cardReversal,
            cardSettlement,
            cardValidation,
            other,
            mutableMapOf(),
        )

        /**
         * The type of the resource. We may add additional possible values for this enum over time;
         * your application should be able to handle such additions gracefully.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
         *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
         */
        fun category(): Category = category.getRequired("category")

        /**
         * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the card
         * payment element was created.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
         *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
         */
        fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")

        /**
         * A Card Authentication object. This field will be present in the JSON response if and only
         * if `category` is equal to `card_authentication`. Card Authentications are attempts to
         * authenticate a transaction or a card with 3DS.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardAuthentication(): Optional<CardAuthentication> =
            cardAuthentication.getOptional("card_authentication")

        /**
         * A Card Authorization object. This field will be present in the JSON response if and only
         * if `category` is equal to `card_authorization`. Card Authorizations are temporary holds
         * placed on a customer's funds with the intent to later clear a transaction.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardAuthorization(): Optional<CardAuthorization> =
            cardAuthorization.getOptional("card_authorization")

        /**
         * A Card Authorization Expiration object. This field will be present in the JSON response
         * if and only if `category` is equal to `card_authorization_expiration`. Card Authorization
         * Expirations are cancellations of authorizations that were never settled by the acquirer.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardAuthorizationExpiration(): Optional<CardAuthorizationExpiration> =
            cardAuthorizationExpiration.getOptional("card_authorization_expiration")

        /**
         * A Card Balance Inquiry object. This field will be present in the JSON response if and
         * only if `category` is equal to `card_balance_inquiry`. Card Balance Inquiries are
         * transactions that allow merchants to check the available balance on a card without
         * placing a hold on funds, commonly used when a customer requests their balance at an ATM.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardBalanceInquiry(): Optional<CardBalanceInquiry> =
            cardBalanceInquiry.getOptional("card_balance_inquiry")

        /**
         * A Card Decline object. This field will be present in the JSON response if and only if
         * `category` is equal to `card_decline`.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardDecline(): Optional<CardDecline> = cardDecline.getOptional("card_decline")

        /**
         * A Card Financial object. This field will be present in the JSON response if and only if
         * `category` is equal to `card_financial`. Card Financials are card transactions that have
         * cleared and settled. Unlike a Card Settlement, which clears a previous authorization, a
         * Card Financial is authorized and cleared in a single message.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardFinancial(): Optional<CardFinancial> = cardFinancial.getOptional("card_financial")

        /**
         * A Card Fuel Confirmation object. This field will be present in the JSON response if and
         * only if `category` is equal to `card_fuel_confirmation`. Card Fuel Confirmations update
         * the amount of a Card Authorization after a fuel pump transaction is completed.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardFuelConfirmation(): Optional<CardFuelConfirmation> =
            cardFuelConfirmation.getOptional("card_fuel_confirmation")

        /**
         * A Card Increment object. This field will be present in the JSON response if and only if
         * `category` is equal to `card_increment`. Card Increments increase the pending amount of
         * an authorized transaction.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardIncrement(): Optional<CardIncrement> = cardIncrement.getOptional("card_increment")

        /**
         * A Card Refund object. This field will be present in the JSON response if and only if
         * `category` is equal to `card_refund`. Card Refunds move money back to the cardholder.
         * While they are usually connected to a Card Settlement, an acquirer can also refund money
         * directly to a card without relation to a transaction.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardRefund(): Optional<CardRefund> = cardRefund.getOptional("card_refund")

        /**
         * A Card Reversal object. This field will be present in the JSON response if and only if
         * `category` is equal to `card_reversal`. Card Reversals cancel parts of or the entirety of
         * an existing Card Authorization.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardReversal(): Optional<CardReversal> = cardReversal.getOptional("card_reversal")

        /**
         * A Card Settlement object. This field will be present in the JSON response if and only if
         * `category` is equal to `card_settlement`. Card Settlements are card transactions that
         * have cleared and settled. While a settlement is usually preceded by an authorization, an
         * acquirer can also directly clear a transaction without first authorizing it.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardSettlement(): Optional<CardSettlement> =
            cardSettlement.getOptional("card_settlement")

        /**
         * An Inbound Card Validation object. This field will be present in the JSON response if and
         * only if `category` is equal to `card_validation`. Inbound Card Validations are requests
         * from a merchant to verify that a card number and optionally its address and/or Card
         * Verification Value are valid.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardValidation(): Optional<CardValidation> =
            cardValidation.getOptional("card_validation")

        /**
         * If the category of this Transaction source is equal to `other`, this field will contain
         * an empty object, otherwise it will contain null.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun other(): Optional<Other> = other.getOptional("other")

        /**
         * Returns the raw JSON value of [category].
         *
         * Unlike [category], this method doesn't throw if the JSON field has an unexpected type.
         */
        @JsonProperty("category") @ExcludeMissing fun _category(): JsonField<Category> = category

        /**
         * Returns the raw JSON value of [createdAt].
         *
         * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type.
         */
        @JsonProperty("created_at")
        @ExcludeMissing
        fun _createdAt(): JsonField<OffsetDateTime> = createdAt

        /**
         * Returns the raw JSON value of [cardAuthentication].
         *
         * Unlike [cardAuthentication], this method doesn't throw if the JSON field has an
         * unexpected type.
         */
        @JsonProperty("card_authentication")
        @ExcludeMissing
        fun _cardAuthentication(): JsonField<CardAuthentication> = cardAuthentication

        /**
         * Returns the raw JSON value of [cardAuthorization].
         *
         * Unlike [cardAuthorization], this method doesn't throw if the JSON field has an unexpected
         * type.
         */
        @JsonProperty("card_authorization")
        @ExcludeMissing
        fun _cardAuthorization(): JsonField<CardAuthorization> = cardAuthorization

        /**
         * Returns the raw JSON value of [cardAuthorizationExpiration].
         *
         * Unlike [cardAuthorizationExpiration], this method doesn't throw if the JSON field has an
         * unexpected type.
         */
        @JsonProperty("card_authorization_expiration")
        @ExcludeMissing
        fun _cardAuthorizationExpiration(): JsonField<CardAuthorizationExpiration> =
            cardAuthorizationExpiration

        /**
         * Returns the raw JSON value of [cardBalanceInquiry].
         *
         * Unlike [cardBalanceInquiry], this method doesn't throw if the JSON field has an
         * unexpected type.
         */
        @JsonProperty("card_balance_inquiry")
        @ExcludeMissing
        fun _cardBalanceInquiry(): JsonField<CardBalanceInquiry> = cardBalanceInquiry

        /**
         * Returns the raw JSON value of [cardDecline].
         *
         * Unlike [cardDecline], this method doesn't throw if the JSON field has an unexpected type.
         */
        @JsonProperty("card_decline")
        @ExcludeMissing
        fun _cardDecline(): JsonField<CardDecline> = cardDecline

        /**
         * Returns the raw JSON value of [cardFinancial].
         *
         * Unlike [cardFinancial], this method doesn't throw if the JSON field has an unexpected
         * type.
         */
        @JsonProperty("card_financial")
        @ExcludeMissing
        fun _cardFinancial(): JsonField<CardFinancial> = cardFinancial

        /**
         * Returns the raw JSON value of [cardFuelConfirmation].
         *
         * Unlike [cardFuelConfirmation], this method doesn't throw if the JSON field has an
         * unexpected type.
         */
        @JsonProperty("card_fuel_confirmation")
        @ExcludeMissing
        fun _cardFuelConfirmation(): JsonField<CardFuelConfirmation> = cardFuelConfirmation

        /**
         * Returns the raw JSON value of [cardIncrement].
         *
         * Unlike [cardIncrement], this method doesn't throw if the JSON field has an unexpected
         * type.
         */
        @JsonProperty("card_increment")
        @ExcludeMissing
        fun _cardIncrement(): JsonField<CardIncrement> = cardIncrement

        /**
         * Returns the raw JSON value of [cardRefund].
         *
         * Unlike [cardRefund], this method doesn't throw if the JSON field has an unexpected type.
         */
        @JsonProperty("card_refund")
        @ExcludeMissing
        fun _cardRefund(): JsonField<CardRefund> = cardRefund

        /**
         * Returns the raw JSON value of [cardReversal].
         *
         * Unlike [cardReversal], this method doesn't throw if the JSON field has an unexpected
         * type.
         */
        @JsonProperty("card_reversal")
        @ExcludeMissing
        fun _cardReversal(): JsonField<CardReversal> = cardReversal

        /**
         * Returns the raw JSON value of [cardSettlement].
         *
         * Unlike [cardSettlement], this method doesn't throw if the JSON field has an unexpected
         * type.
         */
        @JsonProperty("card_settlement")
        @ExcludeMissing
        fun _cardSettlement(): JsonField<CardSettlement> = cardSettlement

        /**
         * Returns the raw JSON value of [cardValidation].
         *
         * Unlike [cardValidation], this method doesn't throw if the JSON field has an unexpected
         * type.
         */
        @JsonProperty("card_validation")
        @ExcludeMissing
        fun _cardValidation(): JsonField<CardValidation> = cardValidation

        /**
         * Returns the raw JSON value of [other].
         *
         * Unlike [other], this method doesn't throw if the JSON field has an unexpected type.
         */
        @JsonProperty("other") @ExcludeMissing fun _other(): JsonField<Other> = other

        @JsonAnySetter
        private fun putAdditionalProperty(key: String, value: JsonValue) {
            additionalProperties.put(key, value)
        }

        @JsonAnyGetter
        @ExcludeMissing
        fun _additionalProperties(): Map<String, JsonValue> =
            Collections.unmodifiableMap(additionalProperties)

        fun toBuilder() = Builder().from(this)

        companion object {

            /**
             * Returns a mutable builder for constructing an instance of [Element].
             *
             * The following fields are required:
             * ```java
             * .category()
             * .createdAt()
             * ```
             */
            @JvmStatic fun builder() = Builder()
        }

        /** A builder for [Element]. */
        class Builder internal constructor() {

            private var category: JsonField<Category>? = null
            private var createdAt: JsonField<OffsetDateTime>? = null
            private var cardAuthentication: JsonField<CardAuthentication> = JsonMissing.of()
            private var cardAuthorization: JsonField<CardAuthorization> = JsonMissing.of()
            private var cardAuthorizationExpiration: JsonField<CardAuthorizationExpiration> =
                JsonMissing.of()
            private var cardBalanceInquiry: JsonField<CardBalanceInquiry> = JsonMissing.of()
            private var cardDecline: JsonField<CardDecline> = JsonMissing.of()
            private var cardFinancial: JsonField<CardFinancial> = JsonMissing.of()
            private var cardFuelConfirmation: JsonField<CardFuelConfirmation> = JsonMissing.of()
            private var cardIncrement: JsonField<CardIncrement> = JsonMissing.of()
            private var cardRefund: JsonField<CardRefund> = JsonMissing.of()
            private var cardReversal: JsonField<CardReversal> = JsonMissing.of()
            private var cardSettlement: JsonField<CardSettlement> = JsonMissing.of()
            private var cardValidation: JsonField<CardValidation> = JsonMissing.of()
            private var other: JsonField<Other> = JsonMissing.of()
            private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

            @JvmSynthetic
            internal fun from(element: Element) = apply {
                category = element.category
                createdAt = element.createdAt
                cardAuthentication = element.cardAuthentication
                cardAuthorization = element.cardAuthorization
                cardAuthorizationExpiration = element.cardAuthorizationExpiration
                cardBalanceInquiry = element.cardBalanceInquiry
                cardDecline = element.cardDecline
                cardFinancial = element.cardFinancial
                cardFuelConfirmation = element.cardFuelConfirmation
                cardIncrement = element.cardIncrement
                cardRefund = element.cardRefund
                cardReversal = element.cardReversal
                cardSettlement = element.cardSettlement
                cardValidation = element.cardValidation
                other = element.other
                additionalProperties = element.additionalProperties.toMutableMap()
            }

            /**
             * The type of the resource. We may add additional possible values for this enum over
             * time; your application should be able to handle such additions gracefully.
             */
            fun category(category: Category) = category(JsonField.of(category))

            /**
             * Sets [Builder.category] to an arbitrary JSON value.
             *
             * You should usually call [Builder.category] with a well-typed [Category] value
             * instead. This method is primarily for setting the field to an undocumented or not yet
             * supported value.
             */
            fun category(category: JsonField<Category>) = apply { this.category = category }

            /**
             * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the
             * card payment element was created.
             */
            fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt))

            /**
             * Sets [Builder.createdAt] to an arbitrary JSON value.
             *
             * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value
             * instead. This method is primarily for setting the field to an undocumented or not yet
             * supported value.
             */
            fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply {
                this.createdAt = createdAt
            }

            /**
             * A Card Authentication object. This field will be present in the JSON response if and
             * only if `category` is equal to `card_authentication`. Card Authentications are
             * attempts to authenticate a transaction or a card with 3DS.
             */
            fun cardAuthentication(cardAuthentication: CardAuthentication?) =
                cardAuthentication(JsonField.ofNullable(cardAuthentication))

            /**
             * Alias for calling [Builder.cardAuthentication] with
             * `cardAuthentication.orElse(null)`.
             */
            fun cardAuthentication(cardAuthentication: Optional<CardAuthentication>) =
                cardAuthentication(cardAuthentication.getOrNull())

            /**
             * Sets [Builder.cardAuthentication] to an arbitrary JSON value.
             *
             * You should usually call [Builder.cardAuthentication] with a well-typed
             * [CardAuthentication] value instead. This method is primarily for setting the field to
             * an undocumented or not yet supported value.
             */
            fun cardAuthentication(cardAuthentication: JsonField<CardAuthentication>) = apply {
                this.cardAuthentication = cardAuthentication
            }

            /**
             * A Card Authorization object. This field will be present in the JSON response if and
             * only if `category` is equal to `card_authorization`. Card Authorizations are
             * temporary holds placed on a customer's funds with the intent to later clear a
             * transaction.
             */
            fun cardAuthorization(cardAuthorization: CardAuthorization?) =
                cardAuthorization(JsonField.ofNullable(cardAuthorization))

            /**
             * Alias for calling [Builder.cardAuthorization] with `cardAuthorization.orElse(null)`.
             */
            fun cardAuthorization(cardAuthorization: Optional<CardAuthorization>) =
                cardAuthorization(cardAuthorization.getOrNull())

            /**
             * Sets [Builder.cardAuthorization] to an arbitrary JSON value.
             *
             * You should usually call [Builder.cardAuthorization] with a well-typed
             * [CardAuthorization] value instead. This method is primarily for setting the field to
             * an undocumented or not yet supported value.
             */
            fun cardAuthorization(cardAuthorization: JsonField<CardAuthorization>) = apply {
                this.cardAuthorization = cardAuthorization
            }

            /**
             * A Card Authorization Expiration object. This field will be present in the JSON
             * response if and only if `category` is equal to `card_authorization_expiration`. Card
             * Authorization Expirations are cancellations of authorizations that were never settled
             * by the acquirer.
             */
            fun cardAuthorizationExpiration(
                cardAuthorizationExpiration: CardAuthorizationExpiration?
            ) = cardAuthorizationExpiration(JsonField.ofNullable(cardAuthorizationExpiration))

            /**
             * Alias for calling [Builder.cardAuthorizationExpiration] with
             * `cardAuthorizationExpiration.orElse(null)`.
             */
            fun cardAuthorizationExpiration(
                cardAuthorizationExpiration: Optional<CardAuthorizationExpiration>
            ) = cardAuthorizationExpiration(cardAuthorizationExpiration.getOrNull())

            /**
             * Sets [Builder.cardAuthorizationExpiration] to an arbitrary JSON value.
             *
             * You should usually call [Builder.cardAuthorizationExpiration] with a well-typed
             * [CardAuthorizationExpiration] value instead. This method is primarily for setting the
             * field to an undocumented or not yet supported value.
             */
            fun cardAuthorizationExpiration(
                cardAuthorizationExpiration: JsonField<CardAuthorizationExpiration>
            ) = apply { this.cardAuthorizationExpiration = cardAuthorizationExpiration }

            /**
             * A Card Balance Inquiry object. This field will be present in the JSON response if and
             * only if `category` is equal to `card_balance_inquiry`. Card Balance Inquiries are
             * transactions that allow merchants to check the available balance on a card without
             * placing a hold on funds, commonly used when a customer requests their balance at an
             * ATM.
             */
            fun cardBalanceInquiry(cardBalanceInquiry: CardBalanceInquiry?) =
                cardBalanceInquiry(JsonField.ofNullable(cardBalanceInquiry))

            /**
             * Alias for calling [Builder.cardBalanceInquiry] with
             * `cardBalanceInquiry.orElse(null)`.
             */
            fun cardBalanceInquiry(cardBalanceInquiry: Optional<CardBalanceInquiry>) =
                cardBalanceInquiry(cardBalanceInquiry.getOrNull())

            /**
             * Sets [Builder.cardBalanceInquiry] to an arbitrary JSON value.
             *
             * You should usually call [Builder.cardBalanceInquiry] with a well-typed
             * [CardBalanceInquiry] value instead. This method is primarily for setting the field to
             * an undocumented or not yet supported value.
             */
            fun cardBalanceInquiry(cardBalanceInquiry: JsonField<CardBalanceInquiry>) = apply {
                this.cardBalanceInquiry = cardBalanceInquiry
            }

            /**
             * A Card Decline object. This field will be present in the JSON response if and only if
             * `category` is equal to `card_decline`.
             */
            fun cardDecline(cardDecline: CardDecline?) =
                cardDecline(JsonField.ofNullable(cardDecline))

            /** Alias for calling [Builder.cardDecline] with `cardDecline.orElse(null)`. */
            fun cardDecline(cardDecline: Optional<CardDecline>) =
                cardDecline(cardDecline.getOrNull())

            /**
             * Sets [Builder.cardDecline] to an arbitrary JSON value.
             *
             * You should usually call [Builder.cardDecline] with a well-typed [CardDecline] value
             * instead. This method is primarily for setting the field to an undocumented or not yet
             * supported value.
             */
            fun cardDecline(cardDecline: JsonField<CardDecline>) = apply {
                this.cardDecline = cardDecline
            }

            /**
             * A Card Financial object. This field will be present in the JSON response if and only
             * if `category` is equal to `card_financial`. Card Financials are card transactions
             * that have cleared and settled. Unlike a Card Settlement, which clears a previous
             * authorization, a Card Financial is authorized and cleared in a single message.
             */
            fun cardFinancial(cardFinancial: CardFinancial?) =
                cardFinancial(JsonField.ofNullable(cardFinancial))

            /** Alias for calling [Builder.cardFinancial] with `cardFinancial.orElse(null)`. */
            fun cardFinancial(cardFinancial: Optional<CardFinancial>) =
                cardFinancial(cardFinancial.getOrNull())

            /**
             * Sets [Builder.cardFinancial] to an arbitrary JSON value.
             *
             * You should usually call [Builder.cardFinancial] with a well-typed [CardFinancial]
             * value instead. This method is primarily for setting the field to an undocumented or
             * not yet supported value.
             */
            fun cardFinancial(cardFinancial: JsonField<CardFinancial>) = apply {
                this.cardFinancial = cardFinancial
            }

            /**
             * A Card Fuel Confirmation object. This field will be present in the JSON response if
             * and only if `category` is equal to `card_fuel_confirmation`. Card Fuel Confirmations
             * update the amount of a Card Authorization after a fuel pump transaction is completed.
             */
            fun cardFuelConfirmation(cardFuelConfirmation: CardFuelConfirmation?) =
                cardFuelConfirmation(JsonField.ofNullable(cardFuelConfirmation))

            /**
             * Alias for calling [Builder.cardFuelConfirmation] with
             * `cardFuelConfirmation.orElse(null)`.
             */
            fun cardFuelConfirmation(cardFuelConfirmation: Optional<CardFuelConfirmation>) =
                cardFuelConfirmation(cardFuelConfirmation.getOrNull())

            /**
             * Sets [Builder.cardFuelConfirmation] to an arbitrary JSON value.
             *
             * You should usually call [Builder.cardFuelConfirmation] with a well-typed
             * [CardFuelConfirmation] value instead. This method is primarily for setting the field
             * to an undocumented or not yet supported value.
             */
            fun cardFuelConfirmation(cardFuelConfirmation: JsonField<CardFuelConfirmation>) =
                apply {
                    this.cardFuelConfirmation = cardFuelConfirmation
                }

            /**
             * A Card Increment object. This field will be present in the JSON response if and only
             * if `category` is equal to `card_increment`. Card Increments increase the pending
             * amount of an authorized transaction.
             */
            fun cardIncrement(cardIncrement: CardIncrement?) =
                cardIncrement(JsonField.ofNullable(cardIncrement))

            /** Alias for calling [Builder.cardIncrement] with `cardIncrement.orElse(null)`. */
            fun cardIncrement(cardIncrement: Optional<CardIncrement>) =
                cardIncrement(cardIncrement.getOrNull())

            /**
             * Sets [Builder.cardIncrement] to an arbitrary JSON value.
             *
             * You should usually call [Builder.cardIncrement] with a well-typed [CardIncrement]
             * value instead. This method is primarily for setting the field to an undocumented or
             * not yet supported value.
             */
            fun cardIncrement(cardIncrement: JsonField<CardIncrement>) = apply {
                this.cardIncrement = cardIncrement
            }

            /**
             * A Card Refund object. This field will be present in the JSON response if and only if
             * `category` is equal to `card_refund`. Card Refunds move money back to the cardholder.
             * While they are usually connected to a Card Settlement, an acquirer can also refund
             * money directly to a card without relation to a transaction.
             */
            fun cardRefund(cardRefund: CardRefund?) = cardRefund(JsonField.ofNullable(cardRefund))

            /** Alias for calling [Builder.cardRefund] with `cardRefund.orElse(null)`. */
            fun cardRefund(cardRefund: Optional<CardRefund>) = cardRefund(cardRefund.getOrNull())

            /**
             * Sets [Builder.cardRefund] to an arbitrary JSON value.
             *
             * You should usually call [Builder.cardRefund] with a well-typed [CardRefund] value
             * instead. This method is primarily for setting the field to an undocumented or not yet
             * supported value.
             */
            fun cardRefund(cardRefund: JsonField<CardRefund>) = apply {
                this.cardRefund = cardRefund
            }

            /**
             * A Card Reversal object. This field will be present in the JSON response if and only
             * if `category` is equal to `card_reversal`. Card Reversals cancel parts of or the
             * entirety of an existing Card Authorization.
             */
            fun cardReversal(cardReversal: CardReversal?) =
                cardReversal(JsonField.ofNullable(cardReversal))

            /** Alias for calling [Builder.cardReversal] with `cardReversal.orElse(null)`. */
            fun cardReversal(cardReversal: Optional<CardReversal>) =
                cardReversal(cardReversal.getOrNull())

            /**
             * Sets [Builder.cardReversal] to an arbitrary JSON value.
             *
             * You should usually call [Builder.cardReversal] with a well-typed [CardReversal] value
             * instead. This method is primarily for setting the field to an undocumented or not yet
             * supported value.
             */
            fun cardReversal(cardReversal: JsonField<CardReversal>) = apply {
                this.cardReversal = cardReversal
            }

            /**
             * A Card Settlement object. This field will be present in the JSON response if and only
             * if `category` is equal to `card_settlement`. Card Settlements are card transactions
             * that have cleared and settled. While a settlement is usually preceded by an
             * authorization, an acquirer can also directly clear a transaction without first
             * authorizing it.
             */
            fun cardSettlement(cardSettlement: CardSettlement?) =
                cardSettlement(JsonField.ofNullable(cardSettlement))

            /** Alias for calling [Builder.cardSettlement] with `cardSettlement.orElse(null)`. */
            fun cardSettlement(cardSettlement: Optional<CardSettlement>) =
                cardSettlement(cardSettlement.getOrNull())

            /**
             * Sets [Builder.cardSettlement] to an arbitrary JSON value.
             *
             * You should usually call [Builder.cardSettlement] with a well-typed [CardSettlement]
             * value instead. This method is primarily for setting the field to an undocumented or
             * not yet supported value.
             */
            fun cardSettlement(cardSettlement: JsonField<CardSettlement>) = apply {
                this.cardSettlement = cardSettlement
            }

            /**
             * An Inbound Card Validation object. This field will be present in the JSON response if
             * and only if `category` is equal to `card_validation`. Inbound Card Validations are
             * requests from a merchant to verify that a card number and optionally its address
             * and/or Card Verification Value are valid.
             */
            fun cardValidation(cardValidation: CardValidation?) =
                cardValidation(JsonField.ofNullable(cardValidation))

            /** Alias for calling [Builder.cardValidation] with `cardValidation.orElse(null)`. */
            fun cardValidation(cardValidation: Optional<CardValidation>) =
                cardValidation(cardValidation.getOrNull())

            /**
             * Sets [Builder.cardValidation] to an arbitrary JSON value.
             *
             * You should usually call [Builder.cardValidation] with a well-typed [CardValidation]
             * value instead. This method is primarily for setting the field to an undocumented or
             * not yet supported value.
             */
            fun cardValidation(cardValidation: JsonField<CardValidation>) = apply {
                this.cardValidation = cardValidation
            }

            /**
             * If the category of this Transaction source is equal to `other`, this field will
             * contain an empty object, otherwise it will contain null.
             */
            fun other(other: Other?) = other(JsonField.ofNullable(other))

            /** Alias for calling [Builder.other] with `other.orElse(null)`. */
            fun other(other: Optional<Other>) = other(other.getOrNull())

            /**
             * Sets [Builder.other] to an arbitrary JSON value.
             *
             * You should usually call [Builder.other] with a well-typed [Other] value instead. This
             * method is primarily for setting the field to an undocumented or not yet supported
             * value.
             */
            fun other(other: JsonField<Other>) = apply { this.other = other }

            fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                this.additionalProperties.clear()
                putAllAdditionalProperties(additionalProperties)
            }

            fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                additionalProperties.put(key, value)
            }

            fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                this.additionalProperties.putAll(additionalProperties)
            }

            fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }

            fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                keys.forEach(::removeAdditionalProperty)
            }

            /**
             * Returns an immutable instance of [Element].
             *
             * Further updates to this [Builder] will not mutate the returned instance.
             *
             * The following fields are required:
             * ```java
             * .category()
             * .createdAt()
             * ```
             *
             * @throws IllegalStateException if any required field is unset.
             */
            fun build(): Element =
                Element(
                    checkRequired("category", category),
                    checkRequired("createdAt", createdAt),
                    cardAuthentication,
                    cardAuthorization,
                    cardAuthorizationExpiration,
                    cardBalanceInquiry,
                    cardDecline,
                    cardFinancial,
                    cardFuelConfirmation,
                    cardIncrement,
                    cardRefund,
                    cardReversal,
                    cardSettlement,
                    cardValidation,
                    other,
                    additionalProperties.toMutableMap(),
                )
        }

        private var validated: Boolean = false

        /**
         * Validates that the types of all values in this object match their expected types
         * recursively.
         *
         * This method is _not_ forwards compatible with new types from the API for existing fields.
         *
         * @throws IncreaseInvalidDataException if any value type in this object doesn't match its
         *   expected type.
         */
        fun validate(): Element = apply {
            if (validated) {
                return@apply
            }

            category().validate()
            createdAt()
            cardAuthentication().ifPresent { it.validate() }
            cardAuthorization().ifPresent { it.validate() }
            cardAuthorizationExpiration().ifPresent { it.validate() }
            cardBalanceInquiry().ifPresent { it.validate() }
            cardDecline().ifPresent { it.validate() }
            cardFinancial().ifPresent { it.validate() }
            cardFuelConfirmation().ifPresent { it.validate() }
            cardIncrement().ifPresent { it.validate() }
            cardRefund().ifPresent { it.validate() }
            cardReversal().ifPresent { it.validate() }
            cardSettlement().ifPresent { it.validate() }
            cardValidation().ifPresent { it.validate() }
            other().ifPresent { it.validate() }
            validated = true
        }

        fun isValid(): Boolean =
            try {
                validate()
                true
            } catch (e: IncreaseInvalidDataException) {
                false
            }

        /**
         * Returns a score indicating how many valid values are contained in this object
         * recursively.
         *
         * Used for best match union deserialization.
         */
        @JvmSynthetic
        internal fun validity(): Int =
            (category.asKnown().getOrNull()?.validity() ?: 0) +
                (if (createdAt.asKnown().isPresent) 1 else 0) +
                (cardAuthentication.asKnown().getOrNull()?.validity() ?: 0) +
                (cardAuthorization.asKnown().getOrNull()?.validity() ?: 0) +
                (cardAuthorizationExpiration.asKnown().getOrNull()?.validity() ?: 0) +
                (cardBalanceInquiry.asKnown().getOrNull()?.validity() ?: 0) +
                (cardDecline.asKnown().getOrNull()?.validity() ?: 0) +
                (cardFinancial.asKnown().getOrNull()?.validity() ?: 0) +
                (cardFuelConfirmation.asKnown().getOrNull()?.validity() ?: 0) +
                (cardIncrement.asKnown().getOrNull()?.validity() ?: 0) +
                (cardRefund.asKnown().getOrNull()?.validity() ?: 0) +
                (cardReversal.asKnown().getOrNull()?.validity() ?: 0) +
                (cardSettlement.asKnown().getOrNull()?.validity() ?: 0) +
                (cardValidation.asKnown().getOrNull()?.validity() ?: 0) +
                (other.asKnown().getOrNull()?.validity() ?: 0)

        /**
         * The type of the resource. We may add additional possible values for this enum over time;
         * your application should be able to handle such additions gracefully.
         */
        class Category @JsonCreator private constructor(private val value: JsonField<String>) :
            Enum {

            /**
             * Returns this class instance's raw value.
             *
             * This is usually only useful if this instance was deserialized from data that doesn't
             * match any known member, and you want to know that value. For example, if the SDK is
             * on an older version than the API, then the API may respond with new members that the
             * SDK is unaware of.
             */
            @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

            companion object {

                /** Card Authorization: details will be under the `card_authorization` object. */
                @JvmField val CARD_AUTHORIZATION = of("card_authorization")

                /** Card Authentication: details will be under the `card_authentication` object. */
                @JvmField val CARD_AUTHENTICATION = of("card_authentication")

                /**
                 * Card Balance Inquiry: details will be under the `card_balance_inquiry` object.
                 */
                @JvmField val CARD_BALANCE_INQUIRY = of("card_balance_inquiry")

                /** Inbound Card Validation: details will be under the `card_validation` object. */
                @JvmField val CARD_VALIDATION = of("card_validation")

                /** Card Decline: details will be under the `card_decline` object. */
                @JvmField val CARD_DECLINE = of("card_decline")

                /** Card Reversal: details will be under the `card_reversal` object. */
                @JvmField val CARD_REVERSAL = of("card_reversal")

                /**
                 * Card Authorization Expiration: details will be under the
                 * `card_authorization_expiration` object.
                 */
                @JvmField val CARD_AUTHORIZATION_EXPIRATION = of("card_authorization_expiration")

                /** Card Increment: details will be under the `card_increment` object. */
                @JvmField val CARD_INCREMENT = of("card_increment")

                /** Card Settlement: details will be under the `card_settlement` object. */
                @JvmField val CARD_SETTLEMENT = of("card_settlement")

                /** Card Refund: details will be under the `card_refund` object. */
                @JvmField val CARD_REFUND = of("card_refund")

                /**
                 * Card Fuel Confirmation: details will be under the `card_fuel_confirmation`
                 * object.
                 */
                @JvmField val CARD_FUEL_CONFIRMATION = of("card_fuel_confirmation")

                /** Card Financial: details will be under the `card_financial` object. */
                @JvmField val CARD_FINANCIAL = of("card_financial")

                /** Unknown card payment element. */
                @JvmField val OTHER = of("other")

                @JvmStatic fun of(value: String) = Category(JsonField.of(value))
            }

            /** An enum containing [Category]'s known values. */
            enum class Known {
                /** Card Authorization: details will be under the `card_authorization` object. */
                CARD_AUTHORIZATION,
                /** Card Authentication: details will be under the `card_authentication` object. */
                CARD_AUTHENTICATION,
                /**
                 * Card Balance Inquiry: details will be under the `card_balance_inquiry` object.
                 */
                CARD_BALANCE_INQUIRY,
                /** Inbound Card Validation: details will be under the `card_validation` object. */
                CARD_VALIDATION,
                /** Card Decline: details will be under the `card_decline` object. */
                CARD_DECLINE,
                /** Card Reversal: details will be under the `card_reversal` object. */
                CARD_REVERSAL,
                /**
                 * Card Authorization Expiration: details will be under the
                 * `card_authorization_expiration` object.
                 */
                CARD_AUTHORIZATION_EXPIRATION,
                /** Card Increment: details will be under the `card_increment` object. */
                CARD_INCREMENT,
                /** Card Settlement: details will be under the `card_settlement` object. */
                CARD_SETTLEMENT,
                /** Card Refund: details will be under the `card_refund` object. */
                CARD_REFUND,
                /**
                 * Card Fuel Confirmation: details will be under the `card_fuel_confirmation`
                 * object.
                 */
                CARD_FUEL_CONFIRMATION,
                /** Card Financial: details will be under the `card_financial` object. */
                CARD_FINANCIAL,
                /** Unknown card payment element. */
                OTHER,
            }

            /**
             * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member.
             *
             * An instance of [Category] can contain an unknown value in a couple of cases:
             * - It was deserialized from data that doesn't match any known member. For example, if
             *   the SDK is on an older version than the API, then the API may respond with new
             *   members that the SDK is unaware of.
             * - It was constructed with an arbitrary value using the [of] method.
             */
            enum class Value {
                /** Card Authorization: details will be under the `card_authorization` object. */
                CARD_AUTHORIZATION,
                /** Card Authentication: details will be under the `card_authentication` object. */
                CARD_AUTHENTICATION,
                /**
                 * Card Balance Inquiry: details will be under the `card_balance_inquiry` object.
                 */
                CARD_BALANCE_INQUIRY,
                /** Inbound Card Validation: details will be under the `card_validation` object. */
                CARD_VALIDATION,
                /** Card Decline: details will be under the `card_decline` object. */
                CARD_DECLINE,
                /** Card Reversal: details will be under the `card_reversal` object. */
                CARD_REVERSAL,
                /**
                 * Card Authorization Expiration: details will be under the
                 * `card_authorization_expiration` object.
                 */
                CARD_AUTHORIZATION_EXPIRATION,
                /** Card Increment: details will be under the `card_increment` object. */
                CARD_INCREMENT,
                /** Card Settlement: details will be under the `card_settlement` object. */
                CARD_SETTLEMENT,
                /** Card Refund: details will be under the `card_refund` object. */
                CARD_REFUND,
                /**
                 * Card Fuel Confirmation: details will be under the `card_fuel_confirmation`
                 * object.
                 */
                CARD_FUEL_CONFIRMATION,
                /** Card Financial: details will be under the `card_financial` object. */
                CARD_FINANCIAL,
                /** Unknown card payment element. */
                OTHER,
                /**
                 * An enum member indicating that [Category] was instantiated with an unknown value.
                 */
                _UNKNOWN,
            }

            /**
             * Returns an enum member corresponding to this class instance's value, or
             * [Value._UNKNOWN] if the class was instantiated with an unknown value.
             *
             * Use the [known] method instead if you're certain the value is always known or if you
             * want to throw for the unknown case.
             */
            fun value(): Value =
                when (this) {
                    CARD_AUTHORIZATION -> Value.CARD_AUTHORIZATION
                    CARD_AUTHENTICATION -> Value.CARD_AUTHENTICATION
                    CARD_BALANCE_INQUIRY -> Value.CARD_BALANCE_INQUIRY
                    CARD_VALIDATION -> Value.CARD_VALIDATION
                    CARD_DECLINE -> Value.CARD_DECLINE
                    CARD_REVERSAL -> Value.CARD_REVERSAL
                    CARD_AUTHORIZATION_EXPIRATION -> Value.CARD_AUTHORIZATION_EXPIRATION
                    CARD_INCREMENT -> Value.CARD_INCREMENT
                    CARD_SETTLEMENT -> Value.CARD_SETTLEMENT
                    CARD_REFUND -> Value.CARD_REFUND
                    CARD_FUEL_CONFIRMATION -> Value.CARD_FUEL_CONFIRMATION
                    CARD_FINANCIAL -> Value.CARD_FINANCIAL
                    OTHER -> Value.OTHER
                    else -> Value._UNKNOWN
                }

            /**
             * Returns an enum member corresponding to this class instance's value.
             *
             * Use the [value] method instead if you're uncertain the value is always known and
             * don't want to throw for the unknown case.
             *
             * @throws IncreaseInvalidDataException if this class instance's value is a not a known
             *   member.
             */
            fun known(): Known =
                when (this) {
                    CARD_AUTHORIZATION -> Known.CARD_AUTHORIZATION
                    CARD_AUTHENTICATION -> Known.CARD_AUTHENTICATION
                    CARD_BALANCE_INQUIRY -> Known.CARD_BALANCE_INQUIRY
                    CARD_VALIDATION -> Known.CARD_VALIDATION
                    CARD_DECLINE -> Known.CARD_DECLINE
                    CARD_REVERSAL -> Known.CARD_REVERSAL
                    CARD_AUTHORIZATION_EXPIRATION -> Known.CARD_AUTHORIZATION_EXPIRATION
                    CARD_INCREMENT -> Known.CARD_INCREMENT
                    CARD_SETTLEMENT -> Known.CARD_SETTLEMENT
                    CARD_REFUND -> Known.CARD_REFUND
                    CARD_FUEL_CONFIRMATION -> Known.CARD_FUEL_CONFIRMATION
                    CARD_FINANCIAL -> Known.CARD_FINANCIAL
                    OTHER -> Known.OTHER
                    else -> throw IncreaseInvalidDataException("Unknown Category: $value")
                }

            /**
             * Returns this class instance's primitive wire representation.
             *
             * This differs from the [toString] method because that method is primarily for
             * debugging and generally doesn't throw.
             *
             * @throws IncreaseInvalidDataException if this class instance's value does not have the
             *   expected primitive type.
             */
            fun asString(): String =
                _value().asString().orElseThrow {
                    IncreaseInvalidDataException("Value is not a String")
                }

            private var validated: Boolean = false

            /**
             * Validates that the types of all values in this object match their expected types
             * recursively.
             *
             * This method is _not_ forwards compatible with new types from the API for existing
             * fields.
             *
             * @throws IncreaseInvalidDataException if any value type in this object doesn't match
             *   its expected type.
             */
            fun validate(): Category = apply {
                if (validated) {
                    return@apply
                }

                known()
                validated = true
            }

            fun isValid(): Boolean =
                try {
                    validate()
                    true
                } catch (e: IncreaseInvalidDataException) {
                    false
                }

            /**
             * Returns a score indicating how many valid values are contained in this object
             * recursively.
             *
             * Used for best match union deserialization.
             */
            @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

            override fun equals(other: Any?): Boolean {
                if (this === other) {
                    return true
                }

                return other is Category && value == other.value
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()
        }

        /**
         * A Card Authentication object. This field will be present in the JSON response if and only
         * if `category` is equal to `card_authentication`. Card Authentications are attempts to
         * authenticate a transaction or a card with 3DS.
         */
        class CardAuthentication
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val id: JsonField<String>,
            private val accessControlServerTransactionIdentifier: JsonField<String>,
            private val billingAddressCity: JsonField<String>,
            private val billingAddressCountry: JsonField<String>,
            private val billingAddressLine1: JsonField<String>,
            private val billingAddressLine2: JsonField<String>,
            private val billingAddressLine3: JsonField<String>,
            private val billingAddressPostalCode: JsonField<String>,
            private val billingAddressState: JsonField<String>,
            private val cardId: JsonField<String>,
            private val cardPaymentId: JsonField<String>,
            private val cardholderEmail: JsonField<String>,
            private val cardholderName: JsonField<String>,
            private val challenge: JsonField<Challenge>,
            private val createdAt: JsonField<OffsetDateTime>,
            private val denyReason: JsonField<DenyReason>,
            private val deviceChannel: JsonField<DeviceChannel>,
            private val directoryServerTransactionIdentifier: JsonField<String>,
            private val merchantAcceptorId: JsonField<String>,
            private val merchantCategoryCode: JsonField<String>,
            private val merchantCountry: JsonField<String>,
            private val merchantName: JsonField<String>,
            private val messageCategory: JsonField<MessageCategory>,
            private val priorAuthenticatedCardPaymentId: JsonField<String>,
            private val realTimeDecisionId: JsonField<String>,
            private val requestorAuthenticationIndicator:
                JsonField<RequestorAuthenticationIndicator>,
            private val requestorChallengeIndicator: JsonField<RequestorChallengeIndicator>,
            private val requestorName: JsonField<String>,
            private val requestorUrl: JsonField<String>,
            private val shippingAddressCity: JsonField<String>,
            private val shippingAddressCountry: JsonField<String>,
            private val shippingAddressLine1: JsonField<String>,
            private val shippingAddressLine2: JsonField<String>,
            private val shippingAddressLine3: JsonField<String>,
            private val shippingAddressPostalCode: JsonField<String>,
            private val shippingAddressState: JsonField<String>,
            private val status: JsonField<Status>,
            private val threeDSecureServerTransactionIdentifier: JsonField<String>,
            private val type: JsonField<Type>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
                @JsonProperty("access_control_server_transaction_identifier")
                @ExcludeMissing
                accessControlServerTransactionIdentifier: JsonField<String> = JsonMissing.of(),
                @JsonProperty("billing_address_city")
                @ExcludeMissing
                billingAddressCity: JsonField<String> = JsonMissing.of(),
                @JsonProperty("billing_address_country")
                @ExcludeMissing
                billingAddressCountry: JsonField<String> = JsonMissing.of(),
                @JsonProperty("billing_address_line1")
                @ExcludeMissing
                billingAddressLine1: JsonField<String> = JsonMissing.of(),
                @JsonProperty("billing_address_line2")
                @ExcludeMissing
                billingAddressLine2: JsonField<String> = JsonMissing.of(),
                @JsonProperty("billing_address_line3")
                @ExcludeMissing
                billingAddressLine3: JsonField<String> = JsonMissing.of(),
                @JsonProperty("billing_address_postal_code")
                @ExcludeMissing
                billingAddressPostalCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("billing_address_state")
                @ExcludeMissing
                billingAddressState: JsonField<String> = JsonMissing.of(),
                @JsonProperty("card_id")
                @ExcludeMissing
                cardId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("card_payment_id")
                @ExcludeMissing
                cardPaymentId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("cardholder_email")
                @ExcludeMissing
                cardholderEmail: JsonField<String> = JsonMissing.of(),
                @JsonProperty("cardholder_name")
                @ExcludeMissing
                cardholderName: JsonField<String> = JsonMissing.of(),
                @JsonProperty("challenge")
                @ExcludeMissing
                challenge: JsonField<Challenge> = JsonMissing.of(),
                @JsonProperty("created_at")
                @ExcludeMissing
                createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                @JsonProperty("deny_reason")
                @ExcludeMissing
                denyReason: JsonField<DenyReason> = JsonMissing.of(),
                @JsonProperty("device_channel")
                @ExcludeMissing
                deviceChannel: JsonField<DeviceChannel> = JsonMissing.of(),
                @JsonProperty("directory_server_transaction_identifier")
                @ExcludeMissing
                directoryServerTransactionIdentifier: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_acceptor_id")
                @ExcludeMissing
                merchantAcceptorId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_category_code")
                @ExcludeMissing
                merchantCategoryCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_country")
                @ExcludeMissing
                merchantCountry: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_name")
                @ExcludeMissing
                merchantName: JsonField<String> = JsonMissing.of(),
                @JsonProperty("message_category")
                @ExcludeMissing
                messageCategory: JsonField<MessageCategory> = JsonMissing.of(),
                @JsonProperty("prior_authenticated_card_payment_id")
                @ExcludeMissing
                priorAuthenticatedCardPaymentId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("real_time_decision_id")
                @ExcludeMissing
                realTimeDecisionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("requestor_authentication_indicator")
                @ExcludeMissing
                requestorAuthenticationIndicator: JsonField<RequestorAuthenticationIndicator> =
                    JsonMissing.of(),
                @JsonProperty("requestor_challenge_indicator")
                @ExcludeMissing
                requestorChallengeIndicator: JsonField<RequestorChallengeIndicator> =
                    JsonMissing.of(),
                @JsonProperty("requestor_name")
                @ExcludeMissing
                requestorName: JsonField<String> = JsonMissing.of(),
                @JsonProperty("requestor_url")
                @ExcludeMissing
                requestorUrl: JsonField<String> = JsonMissing.of(),
                @JsonProperty("shipping_address_city")
                @ExcludeMissing
                shippingAddressCity: JsonField<String> = JsonMissing.of(),
                @JsonProperty("shipping_address_country")
                @ExcludeMissing
                shippingAddressCountry: JsonField<String> = JsonMissing.of(),
                @JsonProperty("shipping_address_line1")
                @ExcludeMissing
                shippingAddressLine1: JsonField<String> = JsonMissing.of(),
                @JsonProperty("shipping_address_line2")
                @ExcludeMissing
                shippingAddressLine2: JsonField<String> = JsonMissing.of(),
                @JsonProperty("shipping_address_line3")
                @ExcludeMissing
                shippingAddressLine3: JsonField<String> = JsonMissing.of(),
                @JsonProperty("shipping_address_postal_code")
                @ExcludeMissing
                shippingAddressPostalCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("shipping_address_state")
                @ExcludeMissing
                shippingAddressState: JsonField<String> = JsonMissing.of(),
                @JsonProperty("status")
                @ExcludeMissing
                status: JsonField<Status> = JsonMissing.of(),
                @JsonProperty("three_d_secure_server_transaction_identifier")
                @ExcludeMissing
                threeDSecureServerTransactionIdentifier: JsonField<String> = JsonMissing.of(),
                @JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
            ) : this(
                id,
                accessControlServerTransactionIdentifier,
                billingAddressCity,
                billingAddressCountry,
                billingAddressLine1,
                billingAddressLine2,
                billingAddressLine3,
                billingAddressPostalCode,
                billingAddressState,
                cardId,
                cardPaymentId,
                cardholderEmail,
                cardholderName,
                challenge,
                createdAt,
                denyReason,
                deviceChannel,
                directoryServerTransactionIdentifier,
                merchantAcceptorId,
                merchantCategoryCode,
                merchantCountry,
                merchantName,
                messageCategory,
                priorAuthenticatedCardPaymentId,
                realTimeDecisionId,
                requestorAuthenticationIndicator,
                requestorChallengeIndicator,
                requestorName,
                requestorUrl,
                shippingAddressCity,
                shippingAddressCountry,
                shippingAddressLine1,
                shippingAddressLine2,
                shippingAddressLine3,
                shippingAddressPostalCode,
                shippingAddressState,
                status,
                threeDSecureServerTransactionIdentifier,
                type,
                mutableMapOf(),
            )

            /**
             * The Card Authentication identifier.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun id(): String = id.getRequired("id")

            /**
             * A unique identifier assigned by the Access Control Server (us) for this transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun accessControlServerTransactionIdentifier(): String =
                accessControlServerTransactionIdentifier.getRequired(
                    "access_control_server_transaction_identifier"
                )

            /**
             * The city of the cardholder billing address associated with the card used for this
             * purchase.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun billingAddressCity(): Optional<String> =
                billingAddressCity.getOptional("billing_address_city")

            /**
             * The country of the cardholder billing address associated with the card used for this
             * purchase.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun billingAddressCountry(): Optional<String> =
                billingAddressCountry.getOptional("billing_address_country")

            /**
             * The first line of the cardholder billing address associated with the card used for
             * this purchase.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun billingAddressLine1(): Optional<String> =
                billingAddressLine1.getOptional("billing_address_line1")

            /**
             * The second line of the cardholder billing address associated with the card used for
             * this purchase.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun billingAddressLine2(): Optional<String> =
                billingAddressLine2.getOptional("billing_address_line2")

            /**
             * The third line of the cardholder billing address associated with the card used for
             * this purchase.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun billingAddressLine3(): Optional<String> =
                billingAddressLine3.getOptional("billing_address_line3")

            /**
             * The postal code of the cardholder billing address associated with the card used for
             * this purchase.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun billingAddressPostalCode(): Optional<String> =
                billingAddressPostalCode.getOptional("billing_address_postal_code")

            /**
             * The US state of the cardholder billing address associated with the card used for this
             * purchase.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun billingAddressState(): Optional<String> =
                billingAddressState.getOptional("billing_address_state")

            /**
             * The identifier of the Card.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun cardId(): String = cardId.getRequired("card_id")

            /**
             * The ID of the Card Payment this transaction belongs to.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun cardPaymentId(): String = cardPaymentId.getRequired("card_payment_id")

            /**
             * The email address of the cardholder.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun cardholderEmail(): Optional<String> =
                cardholderEmail.getOptional("cardholder_email")

            /**
             * The name of the cardholder.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun cardholderName(): Optional<String> = cardholderName.getOptional("cardholder_name")

            /**
             * Details about the challenge, if one was requested.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun challenge(): Optional<Challenge> = challenge.getOptional("challenge")

            /**
             * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Card
             * Authentication was attempted.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")

            /**
             * The reason why this authentication attempt was denied, if it was.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun denyReason(): Optional<DenyReason> = denyReason.getOptional("deny_reason")

            /**
             * The device channel of the card authentication attempt.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun deviceChannel(): DeviceChannel = deviceChannel.getRequired("device_channel")

            /**
             * A unique identifier assigned by the Directory Server (the card network) for this
             * transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun directoryServerTransactionIdentifier(): String =
                directoryServerTransactionIdentifier.getRequired(
                    "directory_server_transaction_identifier"
                )

            /**
             * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantAcceptorId(): Optional<String> =
                merchantAcceptorId.getOptional("merchant_acceptor_id")

            /**
             * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantCategoryCode(): Optional<String> =
                merchantCategoryCode.getOptional("merchant_category_code")

            /**
             * The country the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantCountry(): Optional<String> =
                merchantCountry.getOptional("merchant_country")

            /**
             * The name of the merchant.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantName(): Optional<String> = merchantName.getOptional("merchant_name")

            /**
             * The message category of the card authentication attempt.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun messageCategory(): MessageCategory = messageCategory.getRequired("message_category")

            /**
             * The ID of a prior Card Authentication that the requestor used to authenticate this
             * cardholder for a previous transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun priorAuthenticatedCardPaymentId(): Optional<String> =
                priorAuthenticatedCardPaymentId.getOptional("prior_authenticated_card_payment_id")

            /**
             * The identifier of the Real-Time Decision sent to approve or decline this
             * authentication attempt.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun realTimeDecisionId(): Optional<String> =
                realTimeDecisionId.getOptional("real_time_decision_id")

            /**
             * The 3DS requestor authentication indicator describes why the authentication attempt
             * is performed, such as for a recurring transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun requestorAuthenticationIndicator(): Optional<RequestorAuthenticationIndicator> =
                requestorAuthenticationIndicator.getOptional("requestor_authentication_indicator")

            /**
             * Indicates whether a challenge is requested for this transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun requestorChallengeIndicator(): Optional<RequestorChallengeIndicator> =
                requestorChallengeIndicator.getOptional("requestor_challenge_indicator")

            /**
             * The name of the 3DS requestor.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun requestorName(): String = requestorName.getRequired("requestor_name")

            /**
             * The URL of the 3DS requestor.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun requestorUrl(): String = requestorUrl.getRequired("requestor_url")

            /**
             * The city of the shipping address associated with this purchase.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun shippingAddressCity(): Optional<String> =
                shippingAddressCity.getOptional("shipping_address_city")

            /**
             * The country of the shipping address associated with this purchase.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun shippingAddressCountry(): Optional<String> =
                shippingAddressCountry.getOptional("shipping_address_country")

            /**
             * The first line of the shipping address associated with this purchase.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun shippingAddressLine1(): Optional<String> =
                shippingAddressLine1.getOptional("shipping_address_line1")

            /**
             * The second line of the shipping address associated with this purchase.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun shippingAddressLine2(): Optional<String> =
                shippingAddressLine2.getOptional("shipping_address_line2")

            /**
             * The third line of the shipping address associated with this purchase.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun shippingAddressLine3(): Optional<String> =
                shippingAddressLine3.getOptional("shipping_address_line3")

            /**
             * The postal code of the shipping address associated with this purchase.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun shippingAddressPostalCode(): Optional<String> =
                shippingAddressPostalCode.getOptional("shipping_address_postal_code")

            /**
             * The US state of the shipping address associated with this purchase.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun shippingAddressState(): Optional<String> =
                shippingAddressState.getOptional("shipping_address_state")

            /**
             * The status of the card authentication.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun status(): Status = status.getRequired("status")

            /**
             * A unique identifier assigned by the 3DS Server initiating the authentication attempt
             * for this transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun threeDSecureServerTransactionIdentifier(): String =
                threeDSecureServerTransactionIdentifier.getRequired(
                    "three_d_secure_server_transaction_identifier"
                )

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_authentication`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun type(): Type = type.getRequired("type")

            /**
             * Returns the raw JSON value of [id].
             *
             * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id

            /**
             * Returns the raw JSON value of [accessControlServerTransactionIdentifier].
             *
             * Unlike [accessControlServerTransactionIdentifier], this method doesn't throw if the
             * JSON field has an unexpected type.
             */
            @JsonProperty("access_control_server_transaction_identifier")
            @ExcludeMissing
            fun _accessControlServerTransactionIdentifier(): JsonField<String> =
                accessControlServerTransactionIdentifier

            /**
             * Returns the raw JSON value of [billingAddressCity].
             *
             * Unlike [billingAddressCity], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("billing_address_city")
            @ExcludeMissing
            fun _billingAddressCity(): JsonField<String> = billingAddressCity

            /**
             * Returns the raw JSON value of [billingAddressCountry].
             *
             * Unlike [billingAddressCountry], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("billing_address_country")
            @ExcludeMissing
            fun _billingAddressCountry(): JsonField<String> = billingAddressCountry

            /**
             * Returns the raw JSON value of [billingAddressLine1].
             *
             * Unlike [billingAddressLine1], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("billing_address_line1")
            @ExcludeMissing
            fun _billingAddressLine1(): JsonField<String> = billingAddressLine1

            /**
             * Returns the raw JSON value of [billingAddressLine2].
             *
             * Unlike [billingAddressLine2], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("billing_address_line2")
            @ExcludeMissing
            fun _billingAddressLine2(): JsonField<String> = billingAddressLine2

            /**
             * Returns the raw JSON value of [billingAddressLine3].
             *
             * Unlike [billingAddressLine3], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("billing_address_line3")
            @ExcludeMissing
            fun _billingAddressLine3(): JsonField<String> = billingAddressLine3

            /**
             * Returns the raw JSON value of [billingAddressPostalCode].
             *
             * Unlike [billingAddressPostalCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("billing_address_postal_code")
            @ExcludeMissing
            fun _billingAddressPostalCode(): JsonField<String> = billingAddressPostalCode

            /**
             * Returns the raw JSON value of [billingAddressState].
             *
             * Unlike [billingAddressState], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("billing_address_state")
            @ExcludeMissing
            fun _billingAddressState(): JsonField<String> = billingAddressState

            /**
             * Returns the raw JSON value of [cardId].
             *
             * Unlike [cardId], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("card_id") @ExcludeMissing fun _cardId(): JsonField<String> = cardId

            /**
             * Returns the raw JSON value of [cardPaymentId].
             *
             * Unlike [cardPaymentId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("card_payment_id")
            @ExcludeMissing
            fun _cardPaymentId(): JsonField<String> = cardPaymentId

            /**
             * Returns the raw JSON value of [cardholderEmail].
             *
             * Unlike [cardholderEmail], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("cardholder_email")
            @ExcludeMissing
            fun _cardholderEmail(): JsonField<String> = cardholderEmail

            /**
             * Returns the raw JSON value of [cardholderName].
             *
             * Unlike [cardholderName], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("cardholder_name")
            @ExcludeMissing
            fun _cardholderName(): JsonField<String> = cardholderName

            /**
             * Returns the raw JSON value of [challenge].
             *
             * Unlike [challenge], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("challenge")
            @ExcludeMissing
            fun _challenge(): JsonField<Challenge> = challenge

            /**
             * Returns the raw JSON value of [createdAt].
             *
             * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("created_at")
            @ExcludeMissing
            fun _createdAt(): JsonField<OffsetDateTime> = createdAt

            /**
             * Returns the raw JSON value of [denyReason].
             *
             * Unlike [denyReason], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("deny_reason")
            @ExcludeMissing
            fun _denyReason(): JsonField<DenyReason> = denyReason

            /**
             * Returns the raw JSON value of [deviceChannel].
             *
             * Unlike [deviceChannel], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("device_channel")
            @ExcludeMissing
            fun _deviceChannel(): JsonField<DeviceChannel> = deviceChannel

            /**
             * Returns the raw JSON value of [directoryServerTransactionIdentifier].
             *
             * Unlike [directoryServerTransactionIdentifier], this method doesn't throw if the JSON
             * field has an unexpected type.
             */
            @JsonProperty("directory_server_transaction_identifier")
            @ExcludeMissing
            fun _directoryServerTransactionIdentifier(): JsonField<String> =
                directoryServerTransactionIdentifier

            /**
             * Returns the raw JSON value of [merchantAcceptorId].
             *
             * Unlike [merchantAcceptorId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_acceptor_id")
            @ExcludeMissing
            fun _merchantAcceptorId(): JsonField<String> = merchantAcceptorId

            /**
             * Returns the raw JSON value of [merchantCategoryCode].
             *
             * Unlike [merchantCategoryCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_category_code")
            @ExcludeMissing
            fun _merchantCategoryCode(): JsonField<String> = merchantCategoryCode

            /**
             * Returns the raw JSON value of [merchantCountry].
             *
             * Unlike [merchantCountry], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_country")
            @ExcludeMissing
            fun _merchantCountry(): JsonField<String> = merchantCountry

            /**
             * Returns the raw JSON value of [merchantName].
             *
             * Unlike [merchantName], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_name")
            @ExcludeMissing
            fun _merchantName(): JsonField<String> = merchantName

            /**
             * Returns the raw JSON value of [messageCategory].
             *
             * Unlike [messageCategory], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("message_category")
            @ExcludeMissing
            fun _messageCategory(): JsonField<MessageCategory> = messageCategory

            /**
             * Returns the raw JSON value of [priorAuthenticatedCardPaymentId].
             *
             * Unlike [priorAuthenticatedCardPaymentId], this method doesn't throw if the JSON field
             * has an unexpected type.
             */
            @JsonProperty("prior_authenticated_card_payment_id")
            @ExcludeMissing
            fun _priorAuthenticatedCardPaymentId(): JsonField<String> =
                priorAuthenticatedCardPaymentId

            /**
             * Returns the raw JSON value of [realTimeDecisionId].
             *
             * Unlike [realTimeDecisionId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("real_time_decision_id")
            @ExcludeMissing
            fun _realTimeDecisionId(): JsonField<String> = realTimeDecisionId

            /**
             * Returns the raw JSON value of [requestorAuthenticationIndicator].
             *
             * Unlike [requestorAuthenticationIndicator], this method doesn't throw if the JSON
             * field has an unexpected type.
             */
            @JsonProperty("requestor_authentication_indicator")
            @ExcludeMissing
            fun _requestorAuthenticationIndicator(): JsonField<RequestorAuthenticationIndicator> =
                requestorAuthenticationIndicator

            /**
             * Returns the raw JSON value of [requestorChallengeIndicator].
             *
             * Unlike [requestorChallengeIndicator], this method doesn't throw if the JSON field has
             * an unexpected type.
             */
            @JsonProperty("requestor_challenge_indicator")
            @ExcludeMissing
            fun _requestorChallengeIndicator(): JsonField<RequestorChallengeIndicator> =
                requestorChallengeIndicator

            /**
             * Returns the raw JSON value of [requestorName].
             *
             * Unlike [requestorName], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("requestor_name")
            @ExcludeMissing
            fun _requestorName(): JsonField<String> = requestorName

            /**
             * Returns the raw JSON value of [requestorUrl].
             *
             * Unlike [requestorUrl], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("requestor_url")
            @ExcludeMissing
            fun _requestorUrl(): JsonField<String> = requestorUrl

            /**
             * Returns the raw JSON value of [shippingAddressCity].
             *
             * Unlike [shippingAddressCity], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("shipping_address_city")
            @ExcludeMissing
            fun _shippingAddressCity(): JsonField<String> = shippingAddressCity

            /**
             * Returns the raw JSON value of [shippingAddressCountry].
             *
             * Unlike [shippingAddressCountry], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("shipping_address_country")
            @ExcludeMissing
            fun _shippingAddressCountry(): JsonField<String> = shippingAddressCountry

            /**
             * Returns the raw JSON value of [shippingAddressLine1].
             *
             * Unlike [shippingAddressLine1], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("shipping_address_line1")
            @ExcludeMissing
            fun _shippingAddressLine1(): JsonField<String> = shippingAddressLine1

            /**
             * Returns the raw JSON value of [shippingAddressLine2].
             *
             * Unlike [shippingAddressLine2], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("shipping_address_line2")
            @ExcludeMissing
            fun _shippingAddressLine2(): JsonField<String> = shippingAddressLine2

            /**
             * Returns the raw JSON value of [shippingAddressLine3].
             *
             * Unlike [shippingAddressLine3], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("shipping_address_line3")
            @ExcludeMissing
            fun _shippingAddressLine3(): JsonField<String> = shippingAddressLine3

            /**
             * Returns the raw JSON value of [shippingAddressPostalCode].
             *
             * Unlike [shippingAddressPostalCode], this method doesn't throw if the JSON field has
             * an unexpected type.
             */
            @JsonProperty("shipping_address_postal_code")
            @ExcludeMissing
            fun _shippingAddressPostalCode(): JsonField<String> = shippingAddressPostalCode

            /**
             * Returns the raw JSON value of [shippingAddressState].
             *
             * Unlike [shippingAddressState], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("shipping_address_state")
            @ExcludeMissing
            fun _shippingAddressState(): JsonField<String> = shippingAddressState

            /**
             * Returns the raw JSON value of [status].
             *
             * Unlike [status], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("status") @ExcludeMissing fun _status(): JsonField<Status> = status

            /**
             * Returns the raw JSON value of [threeDSecureServerTransactionIdentifier].
             *
             * Unlike [threeDSecureServerTransactionIdentifier], this method doesn't throw if the
             * JSON field has an unexpected type.
             */
            @JsonProperty("three_d_secure_server_transaction_identifier")
            @ExcludeMissing
            fun _threeDSecureServerTransactionIdentifier(): JsonField<String> =
                threeDSecureServerTransactionIdentifier

            /**
             * Returns the raw JSON value of [type].
             *
             * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("type") @ExcludeMissing fun _type(): JsonField<Type> = type

            @JsonAnySetter
            private fun putAdditionalProperty(key: String, value: JsonValue) {
                additionalProperties.put(key, value)
            }

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map<String, JsonValue> =
                Collections.unmodifiableMap(additionalProperties)

            fun toBuilder() = Builder().from(this)

            companion object {

                /**
                 * Returns a mutable builder for constructing an instance of [CardAuthentication].
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .accessControlServerTransactionIdentifier()
                 * .billingAddressCity()
                 * .billingAddressCountry()
                 * .billingAddressLine1()
                 * .billingAddressLine2()
                 * .billingAddressLine3()
                 * .billingAddressPostalCode()
                 * .billingAddressState()
                 * .cardId()
                 * .cardPaymentId()
                 * .cardholderEmail()
                 * .cardholderName()
                 * .challenge()
                 * .createdAt()
                 * .denyReason()
                 * .deviceChannel()
                 * .directoryServerTransactionIdentifier()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCountry()
                 * .merchantName()
                 * .messageCategory()
                 * .priorAuthenticatedCardPaymentId()
                 * .realTimeDecisionId()
                 * .requestorAuthenticationIndicator()
                 * .requestorChallengeIndicator()
                 * .requestorName()
                 * .requestorUrl()
                 * .shippingAddressCity()
                 * .shippingAddressCountry()
                 * .shippingAddressLine1()
                 * .shippingAddressLine2()
                 * .shippingAddressLine3()
                 * .shippingAddressPostalCode()
                 * .shippingAddressState()
                 * .status()
                 * .threeDSecureServerTransactionIdentifier()
                 * .type()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

            /** A builder for [CardAuthentication]. */
            class Builder internal constructor() {

                private var id: JsonField<String>? = null
                private var accessControlServerTransactionIdentifier: JsonField<String>? = null
                private var billingAddressCity: JsonField<String>? = null
                private var billingAddressCountry: JsonField<String>? = null
                private var billingAddressLine1: JsonField<String>? = null
                private var billingAddressLine2: JsonField<String>? = null
                private var billingAddressLine3: JsonField<String>? = null
                private var billingAddressPostalCode: JsonField<String>? = null
                private var billingAddressState: JsonField<String>? = null
                private var cardId: JsonField<String>? = null
                private var cardPaymentId: JsonField<String>? = null
                private var cardholderEmail: JsonField<String>? = null
                private var cardholderName: JsonField<String>? = null
                private var challenge: JsonField<Challenge>? = null
                private var createdAt: JsonField<OffsetDateTime>? = null
                private var denyReason: JsonField<DenyReason>? = null
                private var deviceChannel: JsonField<DeviceChannel>? = null
                private var directoryServerTransactionIdentifier: JsonField<String>? = null
                private var merchantAcceptorId: JsonField<String>? = null
                private var merchantCategoryCode: JsonField<String>? = null
                private var merchantCountry: JsonField<String>? = null
                private var merchantName: JsonField<String>? = null
                private var messageCategory: JsonField<MessageCategory>? = null
                private var priorAuthenticatedCardPaymentId: JsonField<String>? = null
                private var realTimeDecisionId: JsonField<String>? = null
                private var requestorAuthenticationIndicator:
                    JsonField<RequestorAuthenticationIndicator>? =
                    null
                private var requestorChallengeIndicator: JsonField<RequestorChallengeIndicator>? =
                    null
                private var requestorName: JsonField<String>? = null
                private var requestorUrl: JsonField<String>? = null
                private var shippingAddressCity: JsonField<String>? = null
                private var shippingAddressCountry: JsonField<String>? = null
                private var shippingAddressLine1: JsonField<String>? = null
                private var shippingAddressLine2: JsonField<String>? = null
                private var shippingAddressLine3: JsonField<String>? = null
                private var shippingAddressPostalCode: JsonField<String>? = null
                private var shippingAddressState: JsonField<String>? = null
                private var status: JsonField<Status>? = null
                private var threeDSecureServerTransactionIdentifier: JsonField<String>? = null
                private var type: JsonField<Type>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardAuthentication: CardAuthentication) = apply {
                    id = cardAuthentication.id
                    accessControlServerTransactionIdentifier =
                        cardAuthentication.accessControlServerTransactionIdentifier
                    billingAddressCity = cardAuthentication.billingAddressCity
                    billingAddressCountry = cardAuthentication.billingAddressCountry
                    billingAddressLine1 = cardAuthentication.billingAddressLine1
                    billingAddressLine2 = cardAuthentication.billingAddressLine2
                    billingAddressLine3 = cardAuthentication.billingAddressLine3
                    billingAddressPostalCode = cardAuthentication.billingAddressPostalCode
                    billingAddressState = cardAuthentication.billingAddressState
                    cardId = cardAuthentication.cardId
                    cardPaymentId = cardAuthentication.cardPaymentId
                    cardholderEmail = cardAuthentication.cardholderEmail
                    cardholderName = cardAuthentication.cardholderName
                    challenge = cardAuthentication.challenge
                    createdAt = cardAuthentication.createdAt
                    denyReason = cardAuthentication.denyReason
                    deviceChannel = cardAuthentication.deviceChannel
                    directoryServerTransactionIdentifier =
                        cardAuthentication.directoryServerTransactionIdentifier
                    merchantAcceptorId = cardAuthentication.merchantAcceptorId
                    merchantCategoryCode = cardAuthentication.merchantCategoryCode
                    merchantCountry = cardAuthentication.merchantCountry
                    merchantName = cardAuthentication.merchantName
                    messageCategory = cardAuthentication.messageCategory
                    priorAuthenticatedCardPaymentId =
                        cardAuthentication.priorAuthenticatedCardPaymentId
                    realTimeDecisionId = cardAuthentication.realTimeDecisionId
                    requestorAuthenticationIndicator =
                        cardAuthentication.requestorAuthenticationIndicator
                    requestorChallengeIndicator = cardAuthentication.requestorChallengeIndicator
                    requestorName = cardAuthentication.requestorName
                    requestorUrl = cardAuthentication.requestorUrl
                    shippingAddressCity = cardAuthentication.shippingAddressCity
                    shippingAddressCountry = cardAuthentication.shippingAddressCountry
                    shippingAddressLine1 = cardAuthentication.shippingAddressLine1
                    shippingAddressLine2 = cardAuthentication.shippingAddressLine2
                    shippingAddressLine3 = cardAuthentication.shippingAddressLine3
                    shippingAddressPostalCode = cardAuthentication.shippingAddressPostalCode
                    shippingAddressState = cardAuthentication.shippingAddressState
                    status = cardAuthentication.status
                    threeDSecureServerTransactionIdentifier =
                        cardAuthentication.threeDSecureServerTransactionIdentifier
                    type = cardAuthentication.type
                    additionalProperties = cardAuthentication.additionalProperties.toMutableMap()
                }

                /** The Card Authentication identifier. */
                fun id(id: String) = id(JsonField.of(id))

                /**
                 * Sets [Builder.id] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.id] with a well-typed [String] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun id(id: JsonField<String>) = apply { this.id = id }

                /**
                 * A unique identifier assigned by the Access Control Server (us) for this
                 * transaction.
                 */
                fun accessControlServerTransactionIdentifier(
                    accessControlServerTransactionIdentifier: String
                ) =
                    accessControlServerTransactionIdentifier(
                        JsonField.of(accessControlServerTransactionIdentifier)
                    )

                /**
                 * Sets [Builder.accessControlServerTransactionIdentifier] to an arbitrary JSON
                 * value.
                 *
                 * You should usually call [Builder.accessControlServerTransactionIdentifier] with a
                 * well-typed [String] value instead. This method is primarily for setting the field
                 * to an undocumented or not yet supported value.
                 */
                fun accessControlServerTransactionIdentifier(
                    accessControlServerTransactionIdentifier: JsonField<String>
                ) = apply {
                    this.accessControlServerTransactionIdentifier =
                        accessControlServerTransactionIdentifier
                }

                /**
                 * The city of the cardholder billing address associated with the card used for this
                 * purchase.
                 */
                fun billingAddressCity(billingAddressCity: String?) =
                    billingAddressCity(JsonField.ofNullable(billingAddressCity))

                /**
                 * Alias for calling [Builder.billingAddressCity] with
                 * `billingAddressCity.orElse(null)`.
                 */
                fun billingAddressCity(billingAddressCity: Optional<String>) =
                    billingAddressCity(billingAddressCity.getOrNull())

                /**
                 * Sets [Builder.billingAddressCity] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.billingAddressCity] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun billingAddressCity(billingAddressCity: JsonField<String>) = apply {
                    this.billingAddressCity = billingAddressCity
                }

                /**
                 * The country of the cardholder billing address associated with the card used for
                 * this purchase.
                 */
                fun billingAddressCountry(billingAddressCountry: String?) =
                    billingAddressCountry(JsonField.ofNullable(billingAddressCountry))

                /**
                 * Alias for calling [Builder.billingAddressCountry] with
                 * `billingAddressCountry.orElse(null)`.
                 */
                fun billingAddressCountry(billingAddressCountry: Optional<String>) =
                    billingAddressCountry(billingAddressCountry.getOrNull())

                /**
                 * Sets [Builder.billingAddressCountry] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.billingAddressCountry] with a well-typed
                 * [String] value instead. This method is primarily for setting the field to an
                 * undocumented or not yet supported value.
                 */
                fun billingAddressCountry(billingAddressCountry: JsonField<String>) = apply {
                    this.billingAddressCountry = billingAddressCountry
                }

                /**
                 * The first line of the cardholder billing address associated with the card used
                 * for this purchase.
                 */
                fun billingAddressLine1(billingAddressLine1: String?) =
                    billingAddressLine1(JsonField.ofNullable(billingAddressLine1))

                /**
                 * Alias for calling [Builder.billingAddressLine1] with
                 * `billingAddressLine1.orElse(null)`.
                 */
                fun billingAddressLine1(billingAddressLine1: Optional<String>) =
                    billingAddressLine1(billingAddressLine1.getOrNull())

                /**
                 * Sets [Builder.billingAddressLine1] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.billingAddressLine1] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun billingAddressLine1(billingAddressLine1: JsonField<String>) = apply {
                    this.billingAddressLine1 = billingAddressLine1
                }

                /**
                 * The second line of the cardholder billing address associated with the card used
                 * for this purchase.
                 */
                fun billingAddressLine2(billingAddressLine2: String?) =
                    billingAddressLine2(JsonField.ofNullable(billingAddressLine2))

                /**
                 * Alias for calling [Builder.billingAddressLine2] with
                 * `billingAddressLine2.orElse(null)`.
                 */
                fun billingAddressLine2(billingAddressLine2: Optional<String>) =
                    billingAddressLine2(billingAddressLine2.getOrNull())

                /**
                 * Sets [Builder.billingAddressLine2] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.billingAddressLine2] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun billingAddressLine2(billingAddressLine2: JsonField<String>) = apply {
                    this.billingAddressLine2 = billingAddressLine2
                }

                /**
                 * The third line of the cardholder billing address associated with the card used
                 * for this purchase.
                 */
                fun billingAddressLine3(billingAddressLine3: String?) =
                    billingAddressLine3(JsonField.ofNullable(billingAddressLine3))

                /**
                 * Alias for calling [Builder.billingAddressLine3] with
                 * `billingAddressLine3.orElse(null)`.
                 */
                fun billingAddressLine3(billingAddressLine3: Optional<String>) =
                    billingAddressLine3(billingAddressLine3.getOrNull())

                /**
                 * Sets [Builder.billingAddressLine3] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.billingAddressLine3] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun billingAddressLine3(billingAddressLine3: JsonField<String>) = apply {
                    this.billingAddressLine3 = billingAddressLine3
                }

                /**
                 * The postal code of the cardholder billing address associated with the card used
                 * for this purchase.
                 */
                fun billingAddressPostalCode(billingAddressPostalCode: String?) =
                    billingAddressPostalCode(JsonField.ofNullable(billingAddressPostalCode))

                /**
                 * Alias for calling [Builder.billingAddressPostalCode] with
                 * `billingAddressPostalCode.orElse(null)`.
                 */
                fun billingAddressPostalCode(billingAddressPostalCode: Optional<String>) =
                    billingAddressPostalCode(billingAddressPostalCode.getOrNull())

                /**
                 * Sets [Builder.billingAddressPostalCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.billingAddressPostalCode] with a well-typed
                 * [String] value instead. This method is primarily for setting the field to an
                 * undocumented or not yet supported value.
                 */
                fun billingAddressPostalCode(billingAddressPostalCode: JsonField<String>) = apply {
                    this.billingAddressPostalCode = billingAddressPostalCode
                }

                /**
                 * The US state of the cardholder billing address associated with the card used for
                 * this purchase.
                 */
                fun billingAddressState(billingAddressState: String?) =
                    billingAddressState(JsonField.ofNullable(billingAddressState))

                /**
                 * Alias for calling [Builder.billingAddressState] with
                 * `billingAddressState.orElse(null)`.
                 */
                fun billingAddressState(billingAddressState: Optional<String>) =
                    billingAddressState(billingAddressState.getOrNull())

                /**
                 * Sets [Builder.billingAddressState] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.billingAddressState] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun billingAddressState(billingAddressState: JsonField<String>) = apply {
                    this.billingAddressState = billingAddressState
                }

                /** The identifier of the Card. */
                fun cardId(cardId: String) = cardId(JsonField.of(cardId))

                /**
                 * Sets [Builder.cardId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cardId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun cardId(cardId: JsonField<String>) = apply { this.cardId = cardId }

                /** The ID of the Card Payment this transaction belongs to. */
                fun cardPaymentId(cardPaymentId: String) =
                    cardPaymentId(JsonField.of(cardPaymentId))

                /**
                 * Sets [Builder.cardPaymentId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cardPaymentId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun cardPaymentId(cardPaymentId: JsonField<String>) = apply {
                    this.cardPaymentId = cardPaymentId
                }

                /** The email address of the cardholder. */
                fun cardholderEmail(cardholderEmail: String?) =
                    cardholderEmail(JsonField.ofNullable(cardholderEmail))

                /**
                 * Alias for calling [Builder.cardholderEmail] with `cardholderEmail.orElse(null)`.
                 */
                fun cardholderEmail(cardholderEmail: Optional<String>) =
                    cardholderEmail(cardholderEmail.getOrNull())

                /**
                 * Sets [Builder.cardholderEmail] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cardholderEmail] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun cardholderEmail(cardholderEmail: JsonField<String>) = apply {
                    this.cardholderEmail = cardholderEmail
                }

                /** The name of the cardholder. */
                fun cardholderName(cardholderName: String?) =
                    cardholderName(JsonField.ofNullable(cardholderName))

                /**
                 * Alias for calling [Builder.cardholderName] with `cardholderName.orElse(null)`.
                 */
                fun cardholderName(cardholderName: Optional<String>) =
                    cardholderName(cardholderName.getOrNull())

                /**
                 * Sets [Builder.cardholderName] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cardholderName] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun cardholderName(cardholderName: JsonField<String>) = apply {
                    this.cardholderName = cardholderName
                }

                /** Details about the challenge, if one was requested. */
                fun challenge(challenge: Challenge?) = challenge(JsonField.ofNullable(challenge))

                /** Alias for calling [Builder.challenge] with `challenge.orElse(null)`. */
                fun challenge(challenge: Optional<Challenge>) = challenge(challenge.getOrNull())

                /**
                 * Sets [Builder.challenge] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.challenge] with a well-typed [Challenge] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun challenge(challenge: JsonField<Challenge>) = apply {
                    this.challenge = challenge
                }

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Card
                 * Authentication was attempted.
                 */
                fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt))

                /**
                 * Sets [Builder.createdAt] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply {
                    this.createdAt = createdAt
                }

                /** The reason why this authentication attempt was denied, if it was. */
                fun denyReason(denyReason: DenyReason?) =
                    denyReason(JsonField.ofNullable(denyReason))

                /** Alias for calling [Builder.denyReason] with `denyReason.orElse(null)`. */
                fun denyReason(denyReason: Optional<DenyReason>) =
                    denyReason(denyReason.getOrNull())

                /**
                 * Sets [Builder.denyReason] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.denyReason] with a well-typed [DenyReason] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun denyReason(denyReason: JsonField<DenyReason>) = apply {
                    this.denyReason = denyReason
                }

                /** The device channel of the card authentication attempt. */
                fun deviceChannel(deviceChannel: DeviceChannel) =
                    deviceChannel(JsonField.of(deviceChannel))

                /**
                 * Sets [Builder.deviceChannel] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.deviceChannel] with a well-typed [DeviceChannel]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun deviceChannel(deviceChannel: JsonField<DeviceChannel>) = apply {
                    this.deviceChannel = deviceChannel
                }

                /**
                 * A unique identifier assigned by the Directory Server (the card network) for this
                 * transaction.
                 */
                fun directoryServerTransactionIdentifier(
                    directoryServerTransactionIdentifier: String
                ) =
                    directoryServerTransactionIdentifier(
                        JsonField.of(directoryServerTransactionIdentifier)
                    )

                /**
                 * Sets [Builder.directoryServerTransactionIdentifier] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.directoryServerTransactionIdentifier] with a
                 * well-typed [String] value instead. This method is primarily for setting the field
                 * to an undocumented or not yet supported value.
                 */
                fun directoryServerTransactionIdentifier(
                    directoryServerTransactionIdentifier: JsonField<String>
                ) = apply {
                    this.directoryServerTransactionIdentifier = directoryServerTransactionIdentifier
                }

                /**
                 * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
                 * transacting with.
                 */
                fun merchantAcceptorId(merchantAcceptorId: String?) =
                    merchantAcceptorId(JsonField.ofNullable(merchantAcceptorId))

                /**
                 * Alias for calling [Builder.merchantAcceptorId] with
                 * `merchantAcceptorId.orElse(null)`.
                 */
                fun merchantAcceptorId(merchantAcceptorId: Optional<String>) =
                    merchantAcceptorId(merchantAcceptorId.getOrNull())

                /**
                 * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantAcceptorId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantAcceptorId(merchantAcceptorId: JsonField<String>) = apply {
                    this.merchantAcceptorId = merchantAcceptorId
                }

                /**
                 * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card
                 * is transacting with.
                 */
                fun merchantCategoryCode(merchantCategoryCode: String?) =
                    merchantCategoryCode(JsonField.ofNullable(merchantCategoryCode))

                /**
                 * Alias for calling [Builder.merchantCategoryCode] with
                 * `merchantCategoryCode.orElse(null)`.
                 */
                fun merchantCategoryCode(merchantCategoryCode: Optional<String>) =
                    merchantCategoryCode(merchantCategoryCode.getOrNull())

                /**
                 * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCategoryCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCategoryCode(merchantCategoryCode: JsonField<String>) = apply {
                    this.merchantCategoryCode = merchantCategoryCode
                }

                /** The country the merchant resides in. */
                fun merchantCountry(merchantCountry: String?) =
                    merchantCountry(JsonField.ofNullable(merchantCountry))

                /**
                 * Alias for calling [Builder.merchantCountry] with `merchantCountry.orElse(null)`.
                 */
                fun merchantCountry(merchantCountry: Optional<String>) =
                    merchantCountry(merchantCountry.getOrNull())

                /**
                 * Sets [Builder.merchantCountry] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCountry] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCountry(merchantCountry: JsonField<String>) = apply {
                    this.merchantCountry = merchantCountry
                }

                /** The name of the merchant. */
                fun merchantName(merchantName: String?) =
                    merchantName(JsonField.ofNullable(merchantName))

                /** Alias for calling [Builder.merchantName] with `merchantName.orElse(null)`. */
                fun merchantName(merchantName: Optional<String>) =
                    merchantName(merchantName.getOrNull())

                /**
                 * Sets [Builder.merchantName] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantName] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantName(merchantName: JsonField<String>) = apply {
                    this.merchantName = merchantName
                }

                /** The message category of the card authentication attempt. */
                fun messageCategory(messageCategory: MessageCategory) =
                    messageCategory(JsonField.of(messageCategory))

                /**
                 * Sets [Builder.messageCategory] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.messageCategory] with a well-typed
                 * [MessageCategory] value instead. This method is primarily for setting the field
                 * to an undocumented or not yet supported value.
                 */
                fun messageCategory(messageCategory: JsonField<MessageCategory>) = apply {
                    this.messageCategory = messageCategory
                }

                /**
                 * The ID of a prior Card Authentication that the requestor used to authenticate
                 * this cardholder for a previous transaction.
                 */
                fun priorAuthenticatedCardPaymentId(priorAuthenticatedCardPaymentId: String?) =
                    priorAuthenticatedCardPaymentId(
                        JsonField.ofNullable(priorAuthenticatedCardPaymentId)
                    )

                /**
                 * Alias for calling [Builder.priorAuthenticatedCardPaymentId] with
                 * `priorAuthenticatedCardPaymentId.orElse(null)`.
                 */
                fun priorAuthenticatedCardPaymentId(
                    priorAuthenticatedCardPaymentId: Optional<String>
                ) = priorAuthenticatedCardPaymentId(priorAuthenticatedCardPaymentId.getOrNull())

                /**
                 * Sets [Builder.priorAuthenticatedCardPaymentId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.priorAuthenticatedCardPaymentId] with a
                 * well-typed [String] value instead. This method is primarily for setting the field
                 * to an undocumented or not yet supported value.
                 */
                fun priorAuthenticatedCardPaymentId(
                    priorAuthenticatedCardPaymentId: JsonField<String>
                ) = apply { this.priorAuthenticatedCardPaymentId = priorAuthenticatedCardPaymentId }

                /**
                 * The identifier of the Real-Time Decision sent to approve or decline this
                 * authentication attempt.
                 */
                fun realTimeDecisionId(realTimeDecisionId: String?) =
                    realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId))

                /**
                 * Alias for calling [Builder.realTimeDecisionId] with
                 * `realTimeDecisionId.orElse(null)`.
                 */
                fun realTimeDecisionId(realTimeDecisionId: Optional<String>) =
                    realTimeDecisionId(realTimeDecisionId.getOrNull())

                /**
                 * Sets [Builder.realTimeDecisionId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.realTimeDecisionId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun realTimeDecisionId(realTimeDecisionId: JsonField<String>) = apply {
                    this.realTimeDecisionId = realTimeDecisionId
                }

                /**
                 * The 3DS requestor authentication indicator describes why the authentication
                 * attempt is performed, such as for a recurring transaction.
                 */
                fun requestorAuthenticationIndicator(
                    requestorAuthenticationIndicator: RequestorAuthenticationIndicator?
                ) =
                    requestorAuthenticationIndicator(
                        JsonField.ofNullable(requestorAuthenticationIndicator)
                    )

                /**
                 * Alias for calling [Builder.requestorAuthenticationIndicator] with
                 * `requestorAuthenticationIndicator.orElse(null)`.
                 */
                fun requestorAuthenticationIndicator(
                    requestorAuthenticationIndicator: Optional<RequestorAuthenticationIndicator>
                ) = requestorAuthenticationIndicator(requestorAuthenticationIndicator.getOrNull())

                /**
                 * Sets [Builder.requestorAuthenticationIndicator] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.requestorAuthenticationIndicator] with a
                 * well-typed [RequestorAuthenticationIndicator] value instead. This method is
                 * primarily for setting the field to an undocumented or not yet supported value.
                 */
                fun requestorAuthenticationIndicator(
                    requestorAuthenticationIndicator: JsonField<RequestorAuthenticationIndicator>
                ) = apply {
                    this.requestorAuthenticationIndicator = requestorAuthenticationIndicator
                }

                /** Indicates whether a challenge is requested for this transaction. */
                fun requestorChallengeIndicator(
                    requestorChallengeIndicator: RequestorChallengeIndicator?
                ) = requestorChallengeIndicator(JsonField.ofNullable(requestorChallengeIndicator))

                /**
                 * Alias for calling [Builder.requestorChallengeIndicator] with
                 * `requestorChallengeIndicator.orElse(null)`.
                 */
                fun requestorChallengeIndicator(
                    requestorChallengeIndicator: Optional<RequestorChallengeIndicator>
                ) = requestorChallengeIndicator(requestorChallengeIndicator.getOrNull())

                /**
                 * Sets [Builder.requestorChallengeIndicator] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.requestorChallengeIndicator] with a well-typed
                 * [RequestorChallengeIndicator] value instead. This method is primarily for setting
                 * the field to an undocumented or not yet supported value.
                 */
                fun requestorChallengeIndicator(
                    requestorChallengeIndicator: JsonField<RequestorChallengeIndicator>
                ) = apply { this.requestorChallengeIndicator = requestorChallengeIndicator }

                /** The name of the 3DS requestor. */
                fun requestorName(requestorName: String) =
                    requestorName(JsonField.of(requestorName))

                /**
                 * Sets [Builder.requestorName] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.requestorName] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun requestorName(requestorName: JsonField<String>) = apply {
                    this.requestorName = requestorName
                }

                /** The URL of the 3DS requestor. */
                fun requestorUrl(requestorUrl: String) = requestorUrl(JsonField.of(requestorUrl))

                /**
                 * Sets [Builder.requestorUrl] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.requestorUrl] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun requestorUrl(requestorUrl: JsonField<String>) = apply {
                    this.requestorUrl = requestorUrl
                }

                /** The city of the shipping address associated with this purchase. */
                fun shippingAddressCity(shippingAddressCity: String?) =
                    shippingAddressCity(JsonField.ofNullable(shippingAddressCity))

                /**
                 * Alias for calling [Builder.shippingAddressCity] with
                 * `shippingAddressCity.orElse(null)`.
                 */
                fun shippingAddressCity(shippingAddressCity: Optional<String>) =
                    shippingAddressCity(shippingAddressCity.getOrNull())

                /**
                 * Sets [Builder.shippingAddressCity] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.shippingAddressCity] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun shippingAddressCity(shippingAddressCity: JsonField<String>) = apply {
                    this.shippingAddressCity = shippingAddressCity
                }

                /** The country of the shipping address associated with this purchase. */
                fun shippingAddressCountry(shippingAddressCountry: String?) =
                    shippingAddressCountry(JsonField.ofNullable(shippingAddressCountry))

                /**
                 * Alias for calling [Builder.shippingAddressCountry] with
                 * `shippingAddressCountry.orElse(null)`.
                 */
                fun shippingAddressCountry(shippingAddressCountry: Optional<String>) =
                    shippingAddressCountry(shippingAddressCountry.getOrNull())

                /**
                 * Sets [Builder.shippingAddressCountry] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.shippingAddressCountry] with a well-typed
                 * [String] value instead. This method is primarily for setting the field to an
                 * undocumented or not yet supported value.
                 */
                fun shippingAddressCountry(shippingAddressCountry: JsonField<String>) = apply {
                    this.shippingAddressCountry = shippingAddressCountry
                }

                /** The first line of the shipping address associated with this purchase. */
                fun shippingAddressLine1(shippingAddressLine1: String?) =
                    shippingAddressLine1(JsonField.ofNullable(shippingAddressLine1))

                /**
                 * Alias for calling [Builder.shippingAddressLine1] with
                 * `shippingAddressLine1.orElse(null)`.
                 */
                fun shippingAddressLine1(shippingAddressLine1: Optional<String>) =
                    shippingAddressLine1(shippingAddressLine1.getOrNull())

                /**
                 * Sets [Builder.shippingAddressLine1] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.shippingAddressLine1] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun shippingAddressLine1(shippingAddressLine1: JsonField<String>) = apply {
                    this.shippingAddressLine1 = shippingAddressLine1
                }

                /** The second line of the shipping address associated with this purchase. */
                fun shippingAddressLine2(shippingAddressLine2: String?) =
                    shippingAddressLine2(JsonField.ofNullable(shippingAddressLine2))

                /**
                 * Alias for calling [Builder.shippingAddressLine2] with
                 * `shippingAddressLine2.orElse(null)`.
                 */
                fun shippingAddressLine2(shippingAddressLine2: Optional<String>) =
                    shippingAddressLine2(shippingAddressLine2.getOrNull())

                /**
                 * Sets [Builder.shippingAddressLine2] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.shippingAddressLine2] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun shippingAddressLine2(shippingAddressLine2: JsonField<String>) = apply {
                    this.shippingAddressLine2 = shippingAddressLine2
                }

                /** The third line of the shipping address associated with this purchase. */
                fun shippingAddressLine3(shippingAddressLine3: String?) =
                    shippingAddressLine3(JsonField.ofNullable(shippingAddressLine3))

                /**
                 * Alias for calling [Builder.shippingAddressLine3] with
                 * `shippingAddressLine3.orElse(null)`.
                 */
                fun shippingAddressLine3(shippingAddressLine3: Optional<String>) =
                    shippingAddressLine3(shippingAddressLine3.getOrNull())

                /**
                 * Sets [Builder.shippingAddressLine3] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.shippingAddressLine3] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun shippingAddressLine3(shippingAddressLine3: JsonField<String>) = apply {
                    this.shippingAddressLine3 = shippingAddressLine3
                }

                /** The postal code of the shipping address associated with this purchase. */
                fun shippingAddressPostalCode(shippingAddressPostalCode: String?) =
                    shippingAddressPostalCode(JsonField.ofNullable(shippingAddressPostalCode))

                /**
                 * Alias for calling [Builder.shippingAddressPostalCode] with
                 * `shippingAddressPostalCode.orElse(null)`.
                 */
                fun shippingAddressPostalCode(shippingAddressPostalCode: Optional<String>) =
                    shippingAddressPostalCode(shippingAddressPostalCode.getOrNull())

                /**
                 * Sets [Builder.shippingAddressPostalCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.shippingAddressPostalCode] with a well-typed
                 * [String] value instead. This method is primarily for setting the field to an
                 * undocumented or not yet supported value.
                 */
                fun shippingAddressPostalCode(shippingAddressPostalCode: JsonField<String>) =
                    apply {
                        this.shippingAddressPostalCode = shippingAddressPostalCode
                    }

                /** The US state of the shipping address associated with this purchase. */
                fun shippingAddressState(shippingAddressState: String?) =
                    shippingAddressState(JsonField.ofNullable(shippingAddressState))

                /**
                 * Alias for calling [Builder.shippingAddressState] with
                 * `shippingAddressState.orElse(null)`.
                 */
                fun shippingAddressState(shippingAddressState: Optional<String>) =
                    shippingAddressState(shippingAddressState.getOrNull())

                /**
                 * Sets [Builder.shippingAddressState] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.shippingAddressState] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun shippingAddressState(shippingAddressState: JsonField<String>) = apply {
                    this.shippingAddressState = shippingAddressState
                }

                /** The status of the card authentication. */
                fun status(status: Status) = status(JsonField.of(status))

                /**
                 * Sets [Builder.status] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.status] with a well-typed [Status] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun status(status: JsonField<Status>) = apply { this.status = status }

                /**
                 * A unique identifier assigned by the 3DS Server initiating the authentication
                 * attempt for this transaction.
                 */
                fun threeDSecureServerTransactionIdentifier(
                    threeDSecureServerTransactionIdentifier: String
                ) =
                    threeDSecureServerTransactionIdentifier(
                        JsonField.of(threeDSecureServerTransactionIdentifier)
                    )

                /**
                 * Sets [Builder.threeDSecureServerTransactionIdentifier] to an arbitrary JSON
                 * value.
                 *
                 * You should usually call [Builder.threeDSecureServerTransactionIdentifier] with a
                 * well-typed [String] value instead. This method is primarily for setting the field
                 * to an undocumented or not yet supported value.
                 */
                fun threeDSecureServerTransactionIdentifier(
                    threeDSecureServerTransactionIdentifier: JsonField<String>
                ) = apply {
                    this.threeDSecureServerTransactionIdentifier =
                        threeDSecureServerTransactionIdentifier
                }

                /**
                 * A constant representing the object's type. For this resource it will always be
                 * `card_authentication`.
                 */
                fun type(type: Type) = type(JsonField.of(type))

                /**
                 * Sets [Builder.type] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.type] with a well-typed [Type] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun type(type: JsonField<Type>) = apply { this.type = type }

                fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                    this.additionalProperties.clear()
                    putAllAdditionalProperties(additionalProperties)
                }

                fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                    additionalProperties.put(key, value)
                }

                fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun removeAdditionalProperty(key: String) = apply {
                    additionalProperties.remove(key)
                }

                fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                    keys.forEach(::removeAdditionalProperty)
                }

                /**
                 * Returns an immutable instance of [CardAuthentication].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .accessControlServerTransactionIdentifier()
                 * .billingAddressCity()
                 * .billingAddressCountry()
                 * .billingAddressLine1()
                 * .billingAddressLine2()
                 * .billingAddressLine3()
                 * .billingAddressPostalCode()
                 * .billingAddressState()
                 * .cardId()
                 * .cardPaymentId()
                 * .cardholderEmail()
                 * .cardholderName()
                 * .challenge()
                 * .createdAt()
                 * .denyReason()
                 * .deviceChannel()
                 * .directoryServerTransactionIdentifier()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCountry()
                 * .merchantName()
                 * .messageCategory()
                 * .priorAuthenticatedCardPaymentId()
                 * .realTimeDecisionId()
                 * .requestorAuthenticationIndicator()
                 * .requestorChallengeIndicator()
                 * .requestorName()
                 * .requestorUrl()
                 * .shippingAddressCity()
                 * .shippingAddressCountry()
                 * .shippingAddressLine1()
                 * .shippingAddressLine2()
                 * .shippingAddressLine3()
                 * .shippingAddressPostalCode()
                 * .shippingAddressState()
                 * .status()
                 * .threeDSecureServerTransactionIdentifier()
                 * .type()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardAuthentication =
                    CardAuthentication(
                        checkRequired("id", id),
                        checkRequired(
                            "accessControlServerTransactionIdentifier",
                            accessControlServerTransactionIdentifier,
                        ),
                        checkRequired("billingAddressCity", billingAddressCity),
                        checkRequired("billingAddressCountry", billingAddressCountry),
                        checkRequired("billingAddressLine1", billingAddressLine1),
                        checkRequired("billingAddressLine2", billingAddressLine2),
                        checkRequired("billingAddressLine3", billingAddressLine3),
                        checkRequired("billingAddressPostalCode", billingAddressPostalCode),
                        checkRequired("billingAddressState", billingAddressState),
                        checkRequired("cardId", cardId),
                        checkRequired("cardPaymentId", cardPaymentId),
                        checkRequired("cardholderEmail", cardholderEmail),
                        checkRequired("cardholderName", cardholderName),
                        checkRequired("challenge", challenge),
                        checkRequired("createdAt", createdAt),
                        checkRequired("denyReason", denyReason),
                        checkRequired("deviceChannel", deviceChannel),
                        checkRequired(
                            "directoryServerTransactionIdentifier",
                            directoryServerTransactionIdentifier,
                        ),
                        checkRequired("merchantAcceptorId", merchantAcceptorId),
                        checkRequired("merchantCategoryCode", merchantCategoryCode),
                        checkRequired("merchantCountry", merchantCountry),
                        checkRequired("merchantName", merchantName),
                        checkRequired("messageCategory", messageCategory),
                        checkRequired(
                            "priorAuthenticatedCardPaymentId",
                            priorAuthenticatedCardPaymentId,
                        ),
                        checkRequired("realTimeDecisionId", realTimeDecisionId),
                        checkRequired(
                            "requestorAuthenticationIndicator",
                            requestorAuthenticationIndicator,
                        ),
                        checkRequired("requestorChallengeIndicator", requestorChallengeIndicator),
                        checkRequired("requestorName", requestorName),
                        checkRequired("requestorUrl", requestorUrl),
                        checkRequired("shippingAddressCity", shippingAddressCity),
                        checkRequired("shippingAddressCountry", shippingAddressCountry),
                        checkRequired("shippingAddressLine1", shippingAddressLine1),
                        checkRequired("shippingAddressLine2", shippingAddressLine2),
                        checkRequired("shippingAddressLine3", shippingAddressLine3),
                        checkRequired("shippingAddressPostalCode", shippingAddressPostalCode),
                        checkRequired("shippingAddressState", shippingAddressState),
                        checkRequired("status", status),
                        checkRequired(
                            "threeDSecureServerTransactionIdentifier",
                            threeDSecureServerTransactionIdentifier,
                        ),
                        checkRequired("type", type),
                        additionalProperties.toMutableMap(),
                    )
            }

            private var validated: Boolean = false

            /**
             * Validates that the types of all values in this object match their expected types
             * recursively.
             *
             * This method is _not_ forwards compatible with new types from the API for existing
             * fields.
             *
             * @throws IncreaseInvalidDataException if any value type in this object doesn't match
             *   its expected type.
             */
            fun validate(): CardAuthentication = apply {
                if (validated) {
                    return@apply
                }

                id()
                accessControlServerTransactionIdentifier()
                billingAddressCity()
                billingAddressCountry()
                billingAddressLine1()
                billingAddressLine2()
                billingAddressLine3()
                billingAddressPostalCode()
                billingAddressState()
                cardId()
                cardPaymentId()
                cardholderEmail()
                cardholderName()
                challenge().ifPresent { it.validate() }
                createdAt()
                denyReason().ifPresent { it.validate() }
                deviceChannel().validate()
                directoryServerTransactionIdentifier()
                merchantAcceptorId()
                merchantCategoryCode()
                merchantCountry()
                merchantName()
                messageCategory().validate()
                priorAuthenticatedCardPaymentId()
                realTimeDecisionId()
                requestorAuthenticationIndicator().ifPresent { it.validate() }
                requestorChallengeIndicator().ifPresent { it.validate() }
                requestorName()
                requestorUrl()
                shippingAddressCity()
                shippingAddressCountry()
                shippingAddressLine1()
                shippingAddressLine2()
                shippingAddressLine3()
                shippingAddressPostalCode()
                shippingAddressState()
                status().validate()
                threeDSecureServerTransactionIdentifier()
                type().validate()
                validated = true
            }

            fun isValid(): Boolean =
                try {
                    validate()
                    true
                } catch (e: IncreaseInvalidDataException) {
                    false
                }

            /**
             * Returns a score indicating how many valid values are contained in this object
             * recursively.
             *
             * Used for best match union deserialization.
             */
            @JvmSynthetic
            internal fun validity(): Int =
                (if (id.asKnown().isPresent) 1 else 0) +
                    (if (accessControlServerTransactionIdentifier.asKnown().isPresent) 1 else 0) +
                    (if (billingAddressCity.asKnown().isPresent) 1 else 0) +
                    (if (billingAddressCountry.asKnown().isPresent) 1 else 0) +
                    (if (billingAddressLine1.asKnown().isPresent) 1 else 0) +
                    (if (billingAddressLine2.asKnown().isPresent) 1 else 0) +
                    (if (billingAddressLine3.asKnown().isPresent) 1 else 0) +
                    (if (billingAddressPostalCode.asKnown().isPresent) 1 else 0) +
                    (if (billingAddressState.asKnown().isPresent) 1 else 0) +
                    (if (cardId.asKnown().isPresent) 1 else 0) +
                    (if (cardPaymentId.asKnown().isPresent) 1 else 0) +
                    (if (cardholderEmail.asKnown().isPresent) 1 else 0) +
                    (if (cardholderName.asKnown().isPresent) 1 else 0) +
                    (challenge.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (createdAt.asKnown().isPresent) 1 else 0) +
                    (denyReason.asKnown().getOrNull()?.validity() ?: 0) +
                    (deviceChannel.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (directoryServerTransactionIdentifier.asKnown().isPresent) 1 else 0) +
                    (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) +
                    (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantCountry.asKnown().isPresent) 1 else 0) +
                    (if (merchantName.asKnown().isPresent) 1 else 0) +
                    (messageCategory.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (priorAuthenticatedCardPaymentId.asKnown().isPresent) 1 else 0) +
                    (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) +
                    (requestorAuthenticationIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                    (requestorChallengeIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (requestorName.asKnown().isPresent) 1 else 0) +
                    (if (requestorUrl.asKnown().isPresent) 1 else 0) +
                    (if (shippingAddressCity.asKnown().isPresent) 1 else 0) +
                    (if (shippingAddressCountry.asKnown().isPresent) 1 else 0) +
                    (if (shippingAddressLine1.asKnown().isPresent) 1 else 0) +
                    (if (shippingAddressLine2.asKnown().isPresent) 1 else 0) +
                    (if (shippingAddressLine3.asKnown().isPresent) 1 else 0) +
                    (if (shippingAddressPostalCode.asKnown().isPresent) 1 else 0) +
                    (if (shippingAddressState.asKnown().isPresent) 1 else 0) +
                    (status.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (threeDSecureServerTransactionIdentifier.asKnown().isPresent) 1 else 0) +
                    (type.asKnown().getOrNull()?.validity() ?: 0)

            /** Details about the challenge, if one was requested. */
            class Challenge
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val attempts: JsonField<List<Attempt>>,
                private val createdAt: JsonField<OffsetDateTime>,
                private val oneTimeCode: JsonField<String>,
                private val realTimeDecisionId: JsonField<String>,
                private val verificationMethod: JsonField<VerificationMethod>,
                private val verificationValue: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("attempts")
                    @ExcludeMissing
                    attempts: JsonField<List<Attempt>> = JsonMissing.of(),
                    @JsonProperty("created_at")
                    @ExcludeMissing
                    createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                    @JsonProperty("one_time_code")
                    @ExcludeMissing
                    oneTimeCode: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("real_time_decision_id")
                    @ExcludeMissing
                    realTimeDecisionId: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("verification_method")
                    @ExcludeMissing
                    verificationMethod: JsonField<VerificationMethod> = JsonMissing.of(),
                    @JsonProperty("verification_value")
                    @ExcludeMissing
                    verificationValue: JsonField<String> = JsonMissing.of(),
                ) : this(
                    attempts,
                    createdAt,
                    oneTimeCode,
                    realTimeDecisionId,
                    verificationMethod,
                    verificationValue,
                    mutableMapOf(),
                )

                /**
                 * Details about the challenge verification attempts, if any happened.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun attempts(): List<Attempt> = attempts.getRequired("attempts")

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Card
                 * Authentication Challenge was started.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")

                /**
                 * The one-time code used for the Card Authentication Challenge.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun oneTimeCode(): String = oneTimeCode.getRequired("one_time_code")

                /**
                 * The identifier of the Real-Time Decision used to deliver this challenge.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun realTimeDecisionId(): Optional<String> =
                    realTimeDecisionId.getOptional("real_time_decision_id")

                /**
                 * The method used to verify the Card Authentication Challenge.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun verificationMethod(): VerificationMethod =
                    verificationMethod.getRequired("verification_method")

                /**
                 * E.g., the email address or phone number used for the Card Authentication
                 * Challenge.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun verificationValue(): Optional<String> =
                    verificationValue.getOptional("verification_value")

                /**
                 * Returns the raw JSON value of [attempts].
                 *
                 * Unlike [attempts], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("attempts")
                @ExcludeMissing
                fun _attempts(): JsonField<List<Attempt>> = attempts

                /**
                 * Returns the raw JSON value of [createdAt].
                 *
                 * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("created_at")
                @ExcludeMissing
                fun _createdAt(): JsonField<OffsetDateTime> = createdAt

                /**
                 * Returns the raw JSON value of [oneTimeCode].
                 *
                 * Unlike [oneTimeCode], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("one_time_code")
                @ExcludeMissing
                fun _oneTimeCode(): JsonField<String> = oneTimeCode

                /**
                 * Returns the raw JSON value of [realTimeDecisionId].
                 *
                 * Unlike [realTimeDecisionId], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("real_time_decision_id")
                @ExcludeMissing
                fun _realTimeDecisionId(): JsonField<String> = realTimeDecisionId

                /**
                 * Returns the raw JSON value of [verificationMethod].
                 *
                 * Unlike [verificationMethod], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("verification_method")
                @ExcludeMissing
                fun _verificationMethod(): JsonField<VerificationMethod> = verificationMethod

                /**
                 * Returns the raw JSON value of [verificationValue].
                 *
                 * Unlike [verificationValue], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("verification_value")
                @ExcludeMissing
                fun _verificationValue(): JsonField<String> = verificationValue

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [Challenge].
                     *
                     * The following fields are required:
                     * ```java
                     * .attempts()
                     * .createdAt()
                     * .oneTimeCode()
                     * .realTimeDecisionId()
                     * .verificationMethod()
                     * .verificationValue()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [Challenge]. */
                class Builder internal constructor() {

                    private var attempts: JsonField<MutableList<Attempt>>? = null
                    private var createdAt: JsonField<OffsetDateTime>? = null
                    private var oneTimeCode: JsonField<String>? = null
                    private var realTimeDecisionId: JsonField<String>? = null
                    private var verificationMethod: JsonField<VerificationMethod>? = null
                    private var verificationValue: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(challenge: Challenge) = apply {
                        attempts = challenge.attempts.map { it.toMutableList() }
                        createdAt = challenge.createdAt
                        oneTimeCode = challenge.oneTimeCode
                        realTimeDecisionId = challenge.realTimeDecisionId
                        verificationMethod = challenge.verificationMethod
                        verificationValue = challenge.verificationValue
                        additionalProperties = challenge.additionalProperties.toMutableMap()
                    }

                    /** Details about the challenge verification attempts, if any happened. */
                    fun attempts(attempts: List<Attempt>) = attempts(JsonField.of(attempts))

                    /**
                     * Sets [Builder.attempts] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.attempts] with a well-typed `List<Attempt>`
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun attempts(attempts: JsonField<List<Attempt>>) = apply {
                        this.attempts = attempts.map { it.toMutableList() }
                    }

                    /**
                     * Adds a single [Attempt] to [attempts].
                     *
                     * @throws IllegalStateException if the field was previously set to a non-list.
                     */
                    fun addAttempt(attempt: Attempt) = apply {
                        attempts =
                            (attempts ?: JsonField.of(mutableListOf())).also {
                                checkKnown("attempts", it).add(attempt)
                            }
                    }

                    /**
                     * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Card
                     * Authentication Challenge was started.
                     */
                    fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt))

                    /**
                     * Sets [Builder.createdAt] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.createdAt] with a well-typed
                     * [OffsetDateTime] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply {
                        this.createdAt = createdAt
                    }

                    /** The one-time code used for the Card Authentication Challenge. */
                    fun oneTimeCode(oneTimeCode: String) = oneTimeCode(JsonField.of(oneTimeCode))

                    /**
                     * Sets [Builder.oneTimeCode] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.oneTimeCode] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun oneTimeCode(oneTimeCode: JsonField<String>) = apply {
                        this.oneTimeCode = oneTimeCode
                    }

                    /** The identifier of the Real-Time Decision used to deliver this challenge. */
                    fun realTimeDecisionId(realTimeDecisionId: String?) =
                        realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId))

                    /**
                     * Alias for calling [Builder.realTimeDecisionId] with
                     * `realTimeDecisionId.orElse(null)`.
                     */
                    fun realTimeDecisionId(realTimeDecisionId: Optional<String>) =
                        realTimeDecisionId(realTimeDecisionId.getOrNull())

                    /**
                     * Sets [Builder.realTimeDecisionId] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.realTimeDecisionId] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun realTimeDecisionId(realTimeDecisionId: JsonField<String>) = apply {
                        this.realTimeDecisionId = realTimeDecisionId
                    }

                    /** The method used to verify the Card Authentication Challenge. */
                    fun verificationMethod(verificationMethod: VerificationMethod) =
                        verificationMethod(JsonField.of(verificationMethod))

                    /**
                     * Sets [Builder.verificationMethod] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.verificationMethod] with a well-typed
                     * [VerificationMethod] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun verificationMethod(verificationMethod: JsonField<VerificationMethod>) =
                        apply {
                            this.verificationMethod = verificationMethod
                        }

                    /**
                     * E.g., the email address or phone number used for the Card Authentication
                     * Challenge.
                     */
                    fun verificationValue(verificationValue: String?) =
                        verificationValue(JsonField.ofNullable(verificationValue))

                    /**
                     * Alias for calling [Builder.verificationValue] with
                     * `verificationValue.orElse(null)`.
                     */
                    fun verificationValue(verificationValue: Optional<String>) =
                        verificationValue(verificationValue.getOrNull())

                    /**
                     * Sets [Builder.verificationValue] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.verificationValue] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun verificationValue(verificationValue: JsonField<String>) = apply {
                        this.verificationValue = verificationValue
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [Challenge].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .attempts()
                     * .createdAt()
                     * .oneTimeCode()
                     * .realTimeDecisionId()
                     * .verificationMethod()
                     * .verificationValue()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): Challenge =
                        Challenge(
                            checkRequired("attempts", attempts).map { it.toImmutable() },
                            checkRequired("createdAt", createdAt),
                            checkRequired("oneTimeCode", oneTimeCode),
                            checkRequired("realTimeDecisionId", realTimeDecisionId),
                            checkRequired("verificationMethod", verificationMethod),
                            checkRequired("verificationValue", verificationValue),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Challenge = apply {
                    if (validated) {
                        return@apply
                    }

                    attempts().forEach { it.validate() }
                    createdAt()
                    oneTimeCode()
                    realTimeDecisionId()
                    verificationMethod().validate()
                    verificationValue()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (attempts.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
                        (if (createdAt.asKnown().isPresent) 1 else 0) +
                        (if (oneTimeCode.asKnown().isPresent) 1 else 0) +
                        (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) +
                        (verificationMethod.asKnown().getOrNull()?.validity() ?: 0) +
                        (if (verificationValue.asKnown().isPresent) 1 else 0)

                class Attempt
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val createdAt: JsonField<OffsetDateTime>,
                    private val outcome: JsonField<Outcome>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("created_at")
                        @ExcludeMissing
                        createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                        @JsonProperty("outcome")
                        @ExcludeMissing
                        outcome: JsonField<Outcome> = JsonMissing.of(),
                    ) : this(createdAt, outcome, mutableMapOf())

                    /**
                     * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time of the Card
                     * Authentication Challenge Attempt.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")

                    /**
                     * The outcome of the Card Authentication Challenge Attempt.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun outcome(): Outcome = outcome.getRequired("outcome")

                    /**
                     * Returns the raw JSON value of [createdAt].
                     *
                     * Unlike [createdAt], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("created_at")
                    @ExcludeMissing
                    fun _createdAt(): JsonField<OffsetDateTime> = createdAt

                    /**
                     * Returns the raw JSON value of [outcome].
                     *
                     * Unlike [outcome], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("outcome")
                    @ExcludeMissing
                    fun _outcome(): JsonField<Outcome> = outcome

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Attempt].
                         *
                         * The following fields are required:
                         * ```java
                         * .createdAt()
                         * .outcome()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Attempt]. */
                    class Builder internal constructor() {

                        private var createdAt: JsonField<OffsetDateTime>? = null
                        private var outcome: JsonField<Outcome>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(attempt: Attempt) = apply {
                            createdAt = attempt.createdAt
                            outcome = attempt.outcome
                            additionalProperties = attempt.additionalProperties.toMutableMap()
                        }

                        /**
                         * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time of the Card
                         * Authentication Challenge Attempt.
                         */
                        fun createdAt(createdAt: OffsetDateTime) =
                            createdAt(JsonField.of(createdAt))

                        /**
                         * Sets [Builder.createdAt] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.createdAt] with a well-typed
                         * [OffsetDateTime] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply {
                            this.createdAt = createdAt
                        }

                        /** The outcome of the Card Authentication Challenge Attempt. */
                        fun outcome(outcome: Outcome) = outcome(JsonField.of(outcome))

                        /**
                         * Sets [Builder.outcome] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.outcome] with a well-typed [Outcome]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun outcome(outcome: JsonField<Outcome>) = apply { this.outcome = outcome }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Attempt].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .createdAt()
                         * .outcome()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Attempt =
                            Attempt(
                                checkRequired("createdAt", createdAt),
                                checkRequired("outcome", outcome),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Attempt = apply {
                        if (validated) {
                            return@apply
                        }

                        createdAt()
                        outcome().validate()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (createdAt.asKnown().isPresent) 1 else 0) +
                            (outcome.asKnown().getOrNull()?.validity() ?: 0)

                    /** The outcome of the Card Authentication Challenge Attempt. */
                    class Outcome
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** The attempt was successful. */
                            @JvmField val SUCCESSFUL = of("successful")

                            /** The attempt was unsuccessful. */
                            @JvmField val FAILED = of("failed")

                            @JvmStatic fun of(value: String) = Outcome(JsonField.of(value))
                        }

                        /** An enum containing [Outcome]'s known values. */
                        enum class Known {
                            /** The attempt was successful. */
                            SUCCESSFUL,
                            /** The attempt was unsuccessful. */
                            FAILED,
                        }

                        /**
                         * An enum containing [Outcome]'s known values, as well as an [_UNKNOWN]
                         * member.
                         *
                         * An instance of [Outcome] can contain an unknown value in a couple of
                         * cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** The attempt was successful. */
                            SUCCESSFUL,
                            /** The attempt was unsuccessful. */
                            FAILED,
                            /**
                             * An enum member indicating that [Outcome] was instantiated with an
                             * unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                SUCCESSFUL -> Value.SUCCESSFUL
                                FAILED -> Value.FAILED
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                SUCCESSFUL -> Known.SUCCESSFUL
                                FAILED -> Known.FAILED
                                else ->
                                    throw IncreaseInvalidDataException("Unknown Outcome: $value")
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): Outcome = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is Outcome && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Attempt &&
                            createdAt == other.createdAt &&
                            outcome == other.outcome &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(createdAt, outcome, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Attempt{createdAt=$createdAt, outcome=$outcome, additionalProperties=$additionalProperties}"
                }

                /** The method used to verify the Card Authentication Challenge. */
                class VerificationMethod
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** The one-time code was sent via text message. */
                        @JvmField val TEXT_MESSAGE = of("text_message")

                        /** The one-time code was sent via email. */
                        @JvmField val EMAIL = of("email")

                        /** The one-time code was not successfully delivered. */
                        @JvmField val NONE_AVAILABLE = of("none_available")

                        @JvmStatic fun of(value: String) = VerificationMethod(JsonField.of(value))
                    }

                    /** An enum containing [VerificationMethod]'s known values. */
                    enum class Known {
                        /** The one-time code was sent via text message. */
                        TEXT_MESSAGE,
                        /** The one-time code was sent via email. */
                        EMAIL,
                        /** The one-time code was not successfully delivered. */
                        NONE_AVAILABLE,
                    }

                    /**
                     * An enum containing [VerificationMethod]'s known values, as well as an
                     * [_UNKNOWN] member.
                     *
                     * An instance of [VerificationMethod] can contain an unknown value in a couple
                     * of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** The one-time code was sent via text message. */
                        TEXT_MESSAGE,
                        /** The one-time code was sent via email. */
                        EMAIL,
                        /** The one-time code was not successfully delivered. */
                        NONE_AVAILABLE,
                        /**
                         * An enum member indicating that [VerificationMethod] was instantiated with
                         * an unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            TEXT_MESSAGE -> Value.TEXT_MESSAGE
                            EMAIL -> Value.EMAIL
                            NONE_AVAILABLE -> Value.NONE_AVAILABLE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            TEXT_MESSAGE -> Known.TEXT_MESSAGE
                            EMAIL -> Known.EMAIL
                            NONE_AVAILABLE -> Known.NONE_AVAILABLE
                            else ->
                                throw IncreaseInvalidDataException(
                                    "Unknown VerificationMethod: $value"
                                )
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): VerificationMethod = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is VerificationMethod && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Challenge &&
                        attempts == other.attempts &&
                        createdAt == other.createdAt &&
                        oneTimeCode == other.oneTimeCode &&
                        realTimeDecisionId == other.realTimeDecisionId &&
                        verificationMethod == other.verificationMethod &&
                        verificationValue == other.verificationValue &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        attempts,
                        createdAt,
                        oneTimeCode,
                        realTimeDecisionId,
                        verificationMethod,
                        verificationValue,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "Challenge{attempts=$attempts, createdAt=$createdAt, oneTimeCode=$oneTimeCode, realTimeDecisionId=$realTimeDecisionId, verificationMethod=$verificationMethod, verificationValue=$verificationValue, additionalProperties=$additionalProperties}"
            }

            /** The reason why this authentication attempt was denied, if it was. */
            class DenyReason
            @JsonCreator
            private constructor(private val value: JsonField<String>) : Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** The group was locked. */
                    @JvmField val GROUP_LOCKED = of("group_locked")

                    /** The card was not active. */
                    @JvmField val CARD_NOT_ACTIVE = of("card_not_active")

                    /** The entity was not active. */
                    @JvmField val ENTITY_NOT_ACTIVE = of("entity_not_active")

                    /** The transaction was not allowed. */
                    @JvmField val TRANSACTION_NOT_ALLOWED = of("transaction_not_allowed")

                    /** The webhook was denied. */
                    @JvmField val WEBHOOK_DENIED = of("webhook_denied")

                    /** The webhook timed out. */
                    @JvmField val WEBHOOK_TIMED_OUT = of("webhook_timed_out")

                    @JvmStatic fun of(value: String) = DenyReason(JsonField.of(value))
                }

                /** An enum containing [DenyReason]'s known values. */
                enum class Known {
                    /** The group was locked. */
                    GROUP_LOCKED,
                    /** The card was not active. */
                    CARD_NOT_ACTIVE,
                    /** The entity was not active. */
                    ENTITY_NOT_ACTIVE,
                    /** The transaction was not allowed. */
                    TRANSACTION_NOT_ALLOWED,
                    /** The webhook was denied. */
                    WEBHOOK_DENIED,
                    /** The webhook timed out. */
                    WEBHOOK_TIMED_OUT,
                }

                /**
                 * An enum containing [DenyReason]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [DenyReason] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** The group was locked. */
                    GROUP_LOCKED,
                    /** The card was not active. */
                    CARD_NOT_ACTIVE,
                    /** The entity was not active. */
                    ENTITY_NOT_ACTIVE,
                    /** The transaction was not allowed. */
                    TRANSACTION_NOT_ALLOWED,
                    /** The webhook was denied. */
                    WEBHOOK_DENIED,
                    /** The webhook timed out. */
                    WEBHOOK_TIMED_OUT,
                    /**
                     * An enum member indicating that [DenyReason] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        GROUP_LOCKED -> Value.GROUP_LOCKED
                        CARD_NOT_ACTIVE -> Value.CARD_NOT_ACTIVE
                        ENTITY_NOT_ACTIVE -> Value.ENTITY_NOT_ACTIVE
                        TRANSACTION_NOT_ALLOWED -> Value.TRANSACTION_NOT_ALLOWED
                        WEBHOOK_DENIED -> Value.WEBHOOK_DENIED
                        WEBHOOK_TIMED_OUT -> Value.WEBHOOK_TIMED_OUT
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        GROUP_LOCKED -> Known.GROUP_LOCKED
                        CARD_NOT_ACTIVE -> Known.CARD_NOT_ACTIVE
                        ENTITY_NOT_ACTIVE -> Known.ENTITY_NOT_ACTIVE
                        TRANSACTION_NOT_ALLOWED -> Known.TRANSACTION_NOT_ALLOWED
                        WEBHOOK_DENIED -> Known.WEBHOOK_DENIED
                        WEBHOOK_TIMED_OUT -> Known.WEBHOOK_TIMED_OUT
                        else -> throw IncreaseInvalidDataException("Unknown DenyReason: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): DenyReason = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is DenyReason && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** The device channel of the card authentication attempt. */
            class DeviceChannel
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val browser: JsonField<Browser>,
                private val category: JsonField<Category>,
                private val merchantInitiated: JsonField<MerchantInitiated>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("browser")
                    @ExcludeMissing
                    browser: JsonField<Browser> = JsonMissing.of(),
                    @JsonProperty("category")
                    @ExcludeMissing
                    category: JsonField<Category> = JsonMissing.of(),
                    @JsonProperty("merchant_initiated")
                    @ExcludeMissing
                    merchantInitiated: JsonField<MerchantInitiated> = JsonMissing.of(),
                ) : this(browser, category, merchantInitiated, mutableMapOf())

                /**
                 * Fields specific to the browser device channel.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun browser(): Optional<Browser> = browser.getOptional("browser")

                /**
                 * The category of the device channel.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun category(): Category = category.getRequired("category")

                /**
                 * Fields specific to merchant initiated transactions.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun merchantInitiated(): Optional<MerchantInitiated> =
                    merchantInitiated.getOptional("merchant_initiated")

                /**
                 * Returns the raw JSON value of [browser].
                 *
                 * Unlike [browser], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("browser")
                @ExcludeMissing
                fun _browser(): JsonField<Browser> = browser

                /**
                 * Returns the raw JSON value of [category].
                 *
                 * Unlike [category], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("category")
                @ExcludeMissing
                fun _category(): JsonField<Category> = category

                /**
                 * Returns the raw JSON value of [merchantInitiated].
                 *
                 * Unlike [merchantInitiated], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("merchant_initiated")
                @ExcludeMissing
                fun _merchantInitiated(): JsonField<MerchantInitiated> = merchantInitiated

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [DeviceChannel].
                     *
                     * The following fields are required:
                     * ```java
                     * .browser()
                     * .category()
                     * .merchantInitiated()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [DeviceChannel]. */
                class Builder internal constructor() {

                    private var browser: JsonField<Browser>? = null
                    private var category: JsonField<Category>? = null
                    private var merchantInitiated: JsonField<MerchantInitiated>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(deviceChannel: DeviceChannel) = apply {
                        browser = deviceChannel.browser
                        category = deviceChannel.category
                        merchantInitiated = deviceChannel.merchantInitiated
                        additionalProperties = deviceChannel.additionalProperties.toMutableMap()
                    }

                    /** Fields specific to the browser device channel. */
                    fun browser(browser: Browser?) = browser(JsonField.ofNullable(browser))

                    /** Alias for calling [Builder.browser] with `browser.orElse(null)`. */
                    fun browser(browser: Optional<Browser>) = browser(browser.getOrNull())

                    /**
                     * Sets [Builder.browser] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.browser] with a well-typed [Browser] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun browser(browser: JsonField<Browser>) = apply { this.browser = browser }

                    /** The category of the device channel. */
                    fun category(category: Category) = category(JsonField.of(category))

                    /**
                     * Sets [Builder.category] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.category] with a well-typed [Category] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun category(category: JsonField<Category>) = apply { this.category = category }

                    /** Fields specific to merchant initiated transactions. */
                    fun merchantInitiated(merchantInitiated: MerchantInitiated?) =
                        merchantInitiated(JsonField.ofNullable(merchantInitiated))

                    /**
                     * Alias for calling [Builder.merchantInitiated] with
                     * `merchantInitiated.orElse(null)`.
                     */
                    fun merchantInitiated(merchantInitiated: Optional<MerchantInitiated>) =
                        merchantInitiated(merchantInitiated.getOrNull())

                    /**
                     * Sets [Builder.merchantInitiated] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.merchantInitiated] with a well-typed
                     * [MerchantInitiated] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun merchantInitiated(merchantInitiated: JsonField<MerchantInitiated>) = apply {
                        this.merchantInitiated = merchantInitiated
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [DeviceChannel].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .browser()
                     * .category()
                     * .merchantInitiated()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): DeviceChannel =
                        DeviceChannel(
                            checkRequired("browser", browser),
                            checkRequired("category", category),
                            checkRequired("merchantInitiated", merchantInitiated),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): DeviceChannel = apply {
                    if (validated) {
                        return@apply
                    }

                    browser().ifPresent { it.validate() }
                    category().validate()
                    merchantInitiated().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (browser.asKnown().getOrNull()?.validity() ?: 0) +
                        (category.asKnown().getOrNull()?.validity() ?: 0) +
                        (merchantInitiated.asKnown().getOrNull()?.validity() ?: 0)

                /** Fields specific to the browser device channel. */
                class Browser
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val acceptHeader: JsonField<String>,
                    private val ipAddress: JsonField<String>,
                    private val javascriptEnabled: JsonField<JavascriptEnabled>,
                    private val language: JsonField<String>,
                    private val userAgent: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("accept_header")
                        @ExcludeMissing
                        acceptHeader: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("ip_address")
                        @ExcludeMissing
                        ipAddress: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("javascript_enabled")
                        @ExcludeMissing
                        javascriptEnabled: JsonField<JavascriptEnabled> = JsonMissing.of(),
                        @JsonProperty("language")
                        @ExcludeMissing
                        language: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("user_agent")
                        @ExcludeMissing
                        userAgent: JsonField<String> = JsonMissing.of(),
                    ) : this(
                        acceptHeader,
                        ipAddress,
                        javascriptEnabled,
                        language,
                        userAgent,
                        mutableMapOf(),
                    )

                    /**
                     * The accept header from the cardholder's browser.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun acceptHeader(): Optional<String> = acceptHeader.getOptional("accept_header")

                    /**
                     * The IP address of the cardholder's browser.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun ipAddress(): Optional<String> = ipAddress.getOptional("ip_address")

                    /**
                     * Whether JavaScript is enabled in the cardholder's browser.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun javascriptEnabled(): Optional<JavascriptEnabled> =
                        javascriptEnabled.getOptional("javascript_enabled")

                    /**
                     * The language of the cardholder's browser.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun language(): Optional<String> = language.getOptional("language")

                    /**
                     * The user agent of the cardholder's browser.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun userAgent(): Optional<String> = userAgent.getOptional("user_agent")

                    /**
                     * Returns the raw JSON value of [acceptHeader].
                     *
                     * Unlike [acceptHeader], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("accept_header")
                    @ExcludeMissing
                    fun _acceptHeader(): JsonField<String> = acceptHeader

                    /**
                     * Returns the raw JSON value of [ipAddress].
                     *
                     * Unlike [ipAddress], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("ip_address")
                    @ExcludeMissing
                    fun _ipAddress(): JsonField<String> = ipAddress

                    /**
                     * Returns the raw JSON value of [javascriptEnabled].
                     *
                     * Unlike [javascriptEnabled], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("javascript_enabled")
                    @ExcludeMissing
                    fun _javascriptEnabled(): JsonField<JavascriptEnabled> = javascriptEnabled

                    /**
                     * Returns the raw JSON value of [language].
                     *
                     * Unlike [language], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("language")
                    @ExcludeMissing
                    fun _language(): JsonField<String> = language

                    /**
                     * Returns the raw JSON value of [userAgent].
                     *
                     * Unlike [userAgent], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("user_agent")
                    @ExcludeMissing
                    fun _userAgent(): JsonField<String> = userAgent

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Browser].
                         *
                         * The following fields are required:
                         * ```java
                         * .acceptHeader()
                         * .ipAddress()
                         * .javascriptEnabled()
                         * .language()
                         * .userAgent()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Browser]. */
                    class Builder internal constructor() {

                        private var acceptHeader: JsonField<String>? = null
                        private var ipAddress: JsonField<String>? = null
                        private var javascriptEnabled: JsonField<JavascriptEnabled>? = null
                        private var language: JsonField<String>? = null
                        private var userAgent: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(browser: Browser) = apply {
                            acceptHeader = browser.acceptHeader
                            ipAddress = browser.ipAddress
                            javascriptEnabled = browser.javascriptEnabled
                            language = browser.language
                            userAgent = browser.userAgent
                            additionalProperties = browser.additionalProperties.toMutableMap()
                        }

                        /** The accept header from the cardholder's browser. */
                        fun acceptHeader(acceptHeader: String?) =
                            acceptHeader(JsonField.ofNullable(acceptHeader))

                        /**
                         * Alias for calling [Builder.acceptHeader] with
                         * `acceptHeader.orElse(null)`.
                         */
                        fun acceptHeader(acceptHeader: Optional<String>) =
                            acceptHeader(acceptHeader.getOrNull())

                        /**
                         * Sets [Builder.acceptHeader] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.acceptHeader] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun acceptHeader(acceptHeader: JsonField<String>) = apply {
                            this.acceptHeader = acceptHeader
                        }

                        /** The IP address of the cardholder's browser. */
                        fun ipAddress(ipAddress: String?) =
                            ipAddress(JsonField.ofNullable(ipAddress))

                        /** Alias for calling [Builder.ipAddress] with `ipAddress.orElse(null)`. */
                        fun ipAddress(ipAddress: Optional<String>) =
                            ipAddress(ipAddress.getOrNull())

                        /**
                         * Sets [Builder.ipAddress] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.ipAddress] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun ipAddress(ipAddress: JsonField<String>) = apply {
                            this.ipAddress = ipAddress
                        }

                        /** Whether JavaScript is enabled in the cardholder's browser. */
                        fun javascriptEnabled(javascriptEnabled: JavascriptEnabled?) =
                            javascriptEnabled(JsonField.ofNullable(javascriptEnabled))

                        /**
                         * Alias for calling [Builder.javascriptEnabled] with
                         * `javascriptEnabled.orElse(null)`.
                         */
                        fun javascriptEnabled(javascriptEnabled: Optional<JavascriptEnabled>) =
                            javascriptEnabled(javascriptEnabled.getOrNull())

                        /**
                         * Sets [Builder.javascriptEnabled] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.javascriptEnabled] with a well-typed
                         * [JavascriptEnabled] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun javascriptEnabled(javascriptEnabled: JsonField<JavascriptEnabled>) =
                            apply {
                                this.javascriptEnabled = javascriptEnabled
                            }

                        /** The language of the cardholder's browser. */
                        fun language(language: String?) = language(JsonField.ofNullable(language))

                        /** Alias for calling [Builder.language] with `language.orElse(null)`. */
                        fun language(language: Optional<String>) = language(language.getOrNull())

                        /**
                         * Sets [Builder.language] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.language] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun language(language: JsonField<String>) = apply {
                            this.language = language
                        }

                        /** The user agent of the cardholder's browser. */
                        fun userAgent(userAgent: String?) =
                            userAgent(JsonField.ofNullable(userAgent))

                        /** Alias for calling [Builder.userAgent] with `userAgent.orElse(null)`. */
                        fun userAgent(userAgent: Optional<String>) =
                            userAgent(userAgent.getOrNull())

                        /**
                         * Sets [Builder.userAgent] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.userAgent] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun userAgent(userAgent: JsonField<String>) = apply {
                            this.userAgent = userAgent
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Browser].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .acceptHeader()
                         * .ipAddress()
                         * .javascriptEnabled()
                         * .language()
                         * .userAgent()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Browser =
                            Browser(
                                checkRequired("acceptHeader", acceptHeader),
                                checkRequired("ipAddress", ipAddress),
                                checkRequired("javascriptEnabled", javascriptEnabled),
                                checkRequired("language", language),
                                checkRequired("userAgent", userAgent),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Browser = apply {
                        if (validated) {
                            return@apply
                        }

                        acceptHeader()
                        ipAddress()
                        javascriptEnabled().ifPresent { it.validate() }
                        language()
                        userAgent()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (acceptHeader.asKnown().isPresent) 1 else 0) +
                            (if (ipAddress.asKnown().isPresent) 1 else 0) +
                            (javascriptEnabled.asKnown().getOrNull()?.validity() ?: 0) +
                            (if (language.asKnown().isPresent) 1 else 0) +
                            (if (userAgent.asKnown().isPresent) 1 else 0)

                    /** Whether JavaScript is enabled in the cardholder's browser. */
                    class JavascriptEnabled
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** JavaScript is enabled in the cardholder's browser. */
                            @JvmField val ENABLED = of("enabled")

                            /** JavaScript is not enabled in the cardholder's browser. */
                            @JvmField val DISABLED = of("disabled")

                            @JvmStatic
                            fun of(value: String) = JavascriptEnabled(JsonField.of(value))
                        }

                        /** An enum containing [JavascriptEnabled]'s known values. */
                        enum class Known {
                            /** JavaScript is enabled in the cardholder's browser. */
                            ENABLED,
                            /** JavaScript is not enabled in the cardholder's browser. */
                            DISABLED,
                        }

                        /**
                         * An enum containing [JavascriptEnabled]'s known values, as well as an
                         * [_UNKNOWN] member.
                         *
                         * An instance of [JavascriptEnabled] can contain an unknown value in a
                         * couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** JavaScript is enabled in the cardholder's browser. */
                            ENABLED,
                            /** JavaScript is not enabled in the cardholder's browser. */
                            DISABLED,
                            /**
                             * An enum member indicating that [JavascriptEnabled] was instantiated
                             * with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                ENABLED -> Value.ENABLED
                                DISABLED -> Value.DISABLED
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                ENABLED -> Known.ENABLED
                                DISABLED -> Known.DISABLED
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown JavascriptEnabled: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): JavascriptEnabled = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is JavascriptEnabled && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Browser &&
                            acceptHeader == other.acceptHeader &&
                            ipAddress == other.ipAddress &&
                            javascriptEnabled == other.javascriptEnabled &&
                            language == other.language &&
                            userAgent == other.userAgent &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            acceptHeader,
                            ipAddress,
                            javascriptEnabled,
                            language,
                            userAgent,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Browser{acceptHeader=$acceptHeader, ipAddress=$ipAddress, javascriptEnabled=$javascriptEnabled, language=$language, userAgent=$userAgent, additionalProperties=$additionalProperties}"
                }

                /** The category of the device channel. */
                class Category
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** The authentication attempt was made from an app. */
                        @JvmField val APP = of("app")

                        /** The authentication attempt was made from a browser. */
                        @JvmField val BROWSER = of("browser")

                        /** The authentication attempt was initiated by the 3DS Requestor. */
                        @JvmField
                        val THREE_DS_REQUESTOR_INITIATED = of("three_ds_requestor_initiated")

                        @JvmStatic fun of(value: String) = Category(JsonField.of(value))
                    }

                    /** An enum containing [Category]'s known values. */
                    enum class Known {
                        /** The authentication attempt was made from an app. */
                        APP,
                        /** The authentication attempt was made from a browser. */
                        BROWSER,
                        /** The authentication attempt was initiated by the 3DS Requestor. */
                        THREE_DS_REQUESTOR_INITIATED,
                    }

                    /**
                     * An enum containing [Category]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Category] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** The authentication attempt was made from an app. */
                        APP,
                        /** The authentication attempt was made from a browser. */
                        BROWSER,
                        /** The authentication attempt was initiated by the 3DS Requestor. */
                        THREE_DS_REQUESTOR_INITIATED,
                        /**
                         * An enum member indicating that [Category] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            APP -> Value.APP
                            BROWSER -> Value.BROWSER
                            THREE_DS_REQUESTOR_INITIATED -> Value.THREE_DS_REQUESTOR_INITIATED
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            APP -> Known.APP
                            BROWSER -> Known.BROWSER
                            THREE_DS_REQUESTOR_INITIATED -> Known.THREE_DS_REQUESTOR_INITIATED
                            else -> throw IncreaseInvalidDataException("Unknown Category: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Category = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Category && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** Fields specific to merchant initiated transactions. */
                class MerchantInitiated
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val indicator: JsonField<Indicator>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("indicator")
                        @ExcludeMissing
                        indicator: JsonField<Indicator> = JsonMissing.of()
                    ) : this(indicator, mutableMapOf())

                    /**
                     * The merchant initiated indicator for the transaction.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun indicator(): Indicator = indicator.getRequired("indicator")

                    /**
                     * Returns the raw JSON value of [indicator].
                     *
                     * Unlike [indicator], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("indicator")
                    @ExcludeMissing
                    fun _indicator(): JsonField<Indicator> = indicator

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [MerchantInitiated].
                         *
                         * The following fields are required:
                         * ```java
                         * .indicator()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [MerchantInitiated]. */
                    class Builder internal constructor() {

                        private var indicator: JsonField<Indicator>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(merchantInitiated: MerchantInitiated) = apply {
                            indicator = merchantInitiated.indicator
                            additionalProperties =
                                merchantInitiated.additionalProperties.toMutableMap()
                        }

                        /** The merchant initiated indicator for the transaction. */
                        fun indicator(indicator: Indicator) = indicator(JsonField.of(indicator))

                        /**
                         * Sets [Builder.indicator] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.indicator] with a well-typed [Indicator]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun indicator(indicator: JsonField<Indicator>) = apply {
                            this.indicator = indicator
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [MerchantInitiated].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .indicator()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): MerchantInitiated =
                            MerchantInitiated(
                                checkRequired("indicator", indicator),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): MerchantInitiated = apply {
                        if (validated) {
                            return@apply
                        }

                        indicator().validate()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (indicator.asKnown().getOrNull()?.validity() ?: 0)

                    /** The merchant initiated indicator for the transaction. */
                    class Indicator
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Recurring transaction. */
                            @JvmField val RECURRING_TRANSACTION = of("recurring_transaction")

                            /** Installment transaction. */
                            @JvmField val INSTALLMENT_TRANSACTION = of("installment_transaction")

                            /** Add card. */
                            @JvmField val ADD_CARD = of("add_card")

                            /** Maintain card information. */
                            @JvmField
                            val MAINTAIN_CARD_INFORMATION = of("maintain_card_information")

                            /** Account verification. */
                            @JvmField val ACCOUNT_VERIFICATION = of("account_verification")

                            /** Split or delayed shipment. */
                            @JvmField val SPLIT_DELAYED_SHIPMENT = of("split_delayed_shipment")

                            /** Top up. */
                            @JvmField val TOP_UP = of("top_up")

                            /** Mail order. */
                            @JvmField val MAIL_ORDER = of("mail_order")

                            /** Telephone order. */
                            @JvmField val TELEPHONE_ORDER = of("telephone_order")

                            /** Whitelist status check. */
                            @JvmField val WHITELIST_STATUS_CHECK = of("whitelist_status_check")

                            /** Other payment. */
                            @JvmField val OTHER_PAYMENT = of("other_payment")

                            /** Billing agreement. */
                            @JvmField val BILLING_AGREEMENT = of("billing_agreement")

                            /** Device binding status check. */
                            @JvmField
                            val DEVICE_BINDING_STATUS_CHECK = of("device_binding_status_check")

                            /** Card security code status check. */
                            @JvmField
                            val CARD_SECURITY_CODE_STATUS_CHECK =
                                of("card_security_code_status_check")

                            /** Delayed shipment. */
                            @JvmField val DELAYED_SHIPMENT = of("delayed_shipment")

                            /** Split payment. */
                            @JvmField val SPLIT_PAYMENT = of("split_payment")

                            /** FIDO credential deletion. */
                            @JvmField val FIDO_CREDENTIAL_DELETION = of("fido_credential_deletion")

                            /** FIDO credential registration. */
                            @JvmField
                            val FIDO_CREDENTIAL_REGISTRATION = of("fido_credential_registration")

                            /** Decoupled authentication fallback. */
                            @JvmField
                            val DECOUPLED_AUTHENTICATION_FALLBACK =
                                of("decoupled_authentication_fallback")

                            @JvmStatic fun of(value: String) = Indicator(JsonField.of(value))
                        }

                        /** An enum containing [Indicator]'s known values. */
                        enum class Known {
                            /** Recurring transaction. */
                            RECURRING_TRANSACTION,
                            /** Installment transaction. */
                            INSTALLMENT_TRANSACTION,
                            /** Add card. */
                            ADD_CARD,
                            /** Maintain card information. */
                            MAINTAIN_CARD_INFORMATION,
                            /** Account verification. */
                            ACCOUNT_VERIFICATION,
                            /** Split or delayed shipment. */
                            SPLIT_DELAYED_SHIPMENT,
                            /** Top up. */
                            TOP_UP,
                            /** Mail order. */
                            MAIL_ORDER,
                            /** Telephone order. */
                            TELEPHONE_ORDER,
                            /** Whitelist status check. */
                            WHITELIST_STATUS_CHECK,
                            /** Other payment. */
                            OTHER_PAYMENT,
                            /** Billing agreement. */
                            BILLING_AGREEMENT,
                            /** Device binding status check. */
                            DEVICE_BINDING_STATUS_CHECK,
                            /** Card security code status check. */
                            CARD_SECURITY_CODE_STATUS_CHECK,
                            /** Delayed shipment. */
                            DELAYED_SHIPMENT,
                            /** Split payment. */
                            SPLIT_PAYMENT,
                            /** FIDO credential deletion. */
                            FIDO_CREDENTIAL_DELETION,
                            /** FIDO credential registration. */
                            FIDO_CREDENTIAL_REGISTRATION,
                            /** Decoupled authentication fallback. */
                            DECOUPLED_AUTHENTICATION_FALLBACK,
                        }

                        /**
                         * An enum containing [Indicator]'s known values, as well as an [_UNKNOWN]
                         * member.
                         *
                         * An instance of [Indicator] can contain an unknown value in a couple of
                         * cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Recurring transaction. */
                            RECURRING_TRANSACTION,
                            /** Installment transaction. */
                            INSTALLMENT_TRANSACTION,
                            /** Add card. */
                            ADD_CARD,
                            /** Maintain card information. */
                            MAINTAIN_CARD_INFORMATION,
                            /** Account verification. */
                            ACCOUNT_VERIFICATION,
                            /** Split or delayed shipment. */
                            SPLIT_DELAYED_SHIPMENT,
                            /** Top up. */
                            TOP_UP,
                            /** Mail order. */
                            MAIL_ORDER,
                            /** Telephone order. */
                            TELEPHONE_ORDER,
                            /** Whitelist status check. */
                            WHITELIST_STATUS_CHECK,
                            /** Other payment. */
                            OTHER_PAYMENT,
                            /** Billing agreement. */
                            BILLING_AGREEMENT,
                            /** Device binding status check. */
                            DEVICE_BINDING_STATUS_CHECK,
                            /** Card security code status check. */
                            CARD_SECURITY_CODE_STATUS_CHECK,
                            /** Delayed shipment. */
                            DELAYED_SHIPMENT,
                            /** Split payment. */
                            SPLIT_PAYMENT,
                            /** FIDO credential deletion. */
                            FIDO_CREDENTIAL_DELETION,
                            /** FIDO credential registration. */
                            FIDO_CREDENTIAL_REGISTRATION,
                            /** Decoupled authentication fallback. */
                            DECOUPLED_AUTHENTICATION_FALLBACK,
                            /**
                             * An enum member indicating that [Indicator] was instantiated with an
                             * unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                RECURRING_TRANSACTION -> Value.RECURRING_TRANSACTION
                                INSTALLMENT_TRANSACTION -> Value.INSTALLMENT_TRANSACTION
                                ADD_CARD -> Value.ADD_CARD
                                MAINTAIN_CARD_INFORMATION -> Value.MAINTAIN_CARD_INFORMATION
                                ACCOUNT_VERIFICATION -> Value.ACCOUNT_VERIFICATION
                                SPLIT_DELAYED_SHIPMENT -> Value.SPLIT_DELAYED_SHIPMENT
                                TOP_UP -> Value.TOP_UP
                                MAIL_ORDER -> Value.MAIL_ORDER
                                TELEPHONE_ORDER -> Value.TELEPHONE_ORDER
                                WHITELIST_STATUS_CHECK -> Value.WHITELIST_STATUS_CHECK
                                OTHER_PAYMENT -> Value.OTHER_PAYMENT
                                BILLING_AGREEMENT -> Value.BILLING_AGREEMENT
                                DEVICE_BINDING_STATUS_CHECK -> Value.DEVICE_BINDING_STATUS_CHECK
                                CARD_SECURITY_CODE_STATUS_CHECK ->
                                    Value.CARD_SECURITY_CODE_STATUS_CHECK
                                DELAYED_SHIPMENT -> Value.DELAYED_SHIPMENT
                                SPLIT_PAYMENT -> Value.SPLIT_PAYMENT
                                FIDO_CREDENTIAL_DELETION -> Value.FIDO_CREDENTIAL_DELETION
                                FIDO_CREDENTIAL_REGISTRATION -> Value.FIDO_CREDENTIAL_REGISTRATION
                                DECOUPLED_AUTHENTICATION_FALLBACK ->
                                    Value.DECOUPLED_AUTHENTICATION_FALLBACK
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                RECURRING_TRANSACTION -> Known.RECURRING_TRANSACTION
                                INSTALLMENT_TRANSACTION -> Known.INSTALLMENT_TRANSACTION
                                ADD_CARD -> Known.ADD_CARD
                                MAINTAIN_CARD_INFORMATION -> Known.MAINTAIN_CARD_INFORMATION
                                ACCOUNT_VERIFICATION -> Known.ACCOUNT_VERIFICATION
                                SPLIT_DELAYED_SHIPMENT -> Known.SPLIT_DELAYED_SHIPMENT
                                TOP_UP -> Known.TOP_UP
                                MAIL_ORDER -> Known.MAIL_ORDER
                                TELEPHONE_ORDER -> Known.TELEPHONE_ORDER
                                WHITELIST_STATUS_CHECK -> Known.WHITELIST_STATUS_CHECK
                                OTHER_PAYMENT -> Known.OTHER_PAYMENT
                                BILLING_AGREEMENT -> Known.BILLING_AGREEMENT
                                DEVICE_BINDING_STATUS_CHECK -> Known.DEVICE_BINDING_STATUS_CHECK
                                CARD_SECURITY_CODE_STATUS_CHECK ->
                                    Known.CARD_SECURITY_CODE_STATUS_CHECK
                                DELAYED_SHIPMENT -> Known.DELAYED_SHIPMENT
                                SPLIT_PAYMENT -> Known.SPLIT_PAYMENT
                                FIDO_CREDENTIAL_DELETION -> Known.FIDO_CREDENTIAL_DELETION
                                FIDO_CREDENTIAL_REGISTRATION -> Known.FIDO_CREDENTIAL_REGISTRATION
                                DECOUPLED_AUTHENTICATION_FALLBACK ->
                                    Known.DECOUPLED_AUTHENTICATION_FALLBACK
                                else ->
                                    throw IncreaseInvalidDataException("Unknown Indicator: $value")
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): Indicator = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is Indicator && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is MerchantInitiated &&
                            indicator == other.indicator &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(indicator, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "MerchantInitiated{indicator=$indicator, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is DeviceChannel &&
                        browser == other.browser &&
                        category == other.category &&
                        merchantInitiated == other.merchantInitiated &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(browser, category, merchantInitiated, additionalProperties)
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "DeviceChannel{browser=$browser, category=$category, merchantInitiated=$merchantInitiated, additionalProperties=$additionalProperties}"
            }

            /** The message category of the card authentication attempt. */
            class MessageCategory
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val category: JsonField<Category>,
                private val nonPayment: JsonField<NonPayment>,
                private val payment: JsonField<Payment>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("category")
                    @ExcludeMissing
                    category: JsonField<Category> = JsonMissing.of(),
                    @JsonProperty("non_payment")
                    @ExcludeMissing
                    nonPayment: JsonField<NonPayment> = JsonMissing.of(),
                    @JsonProperty("payment")
                    @ExcludeMissing
                    payment: JsonField<Payment> = JsonMissing.of(),
                ) : this(category, nonPayment, payment, mutableMapOf())

                /**
                 * The category of the card authentication attempt.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun category(): Category = category.getRequired("category")

                /**
                 * Fields specific to non-payment authentication attempts.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun nonPayment(): Optional<NonPayment> = nonPayment.getOptional("non_payment")

                /**
                 * Fields specific to payment authentication attempts.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun payment(): Optional<Payment> = payment.getOptional("payment")

                /**
                 * Returns the raw JSON value of [category].
                 *
                 * Unlike [category], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("category")
                @ExcludeMissing
                fun _category(): JsonField<Category> = category

                /**
                 * Returns the raw JSON value of [nonPayment].
                 *
                 * Unlike [nonPayment], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("non_payment")
                @ExcludeMissing
                fun _nonPayment(): JsonField<NonPayment> = nonPayment

                /**
                 * Returns the raw JSON value of [payment].
                 *
                 * Unlike [payment], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("payment")
                @ExcludeMissing
                fun _payment(): JsonField<Payment> = payment

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [MessageCategory].
                     *
                     * The following fields are required:
                     * ```java
                     * .category()
                     * .nonPayment()
                     * .payment()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [MessageCategory]. */
                class Builder internal constructor() {

                    private var category: JsonField<Category>? = null
                    private var nonPayment: JsonField<NonPayment>? = null
                    private var payment: JsonField<Payment>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(messageCategory: MessageCategory) = apply {
                        category = messageCategory.category
                        nonPayment = messageCategory.nonPayment
                        payment = messageCategory.payment
                        additionalProperties = messageCategory.additionalProperties.toMutableMap()
                    }

                    /** The category of the card authentication attempt. */
                    fun category(category: Category) = category(JsonField.of(category))

                    /**
                     * Sets [Builder.category] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.category] with a well-typed [Category] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun category(category: JsonField<Category>) = apply { this.category = category }

                    /** Fields specific to non-payment authentication attempts. */
                    fun nonPayment(nonPayment: NonPayment?) =
                        nonPayment(JsonField.ofNullable(nonPayment))

                    /** Alias for calling [Builder.nonPayment] with `nonPayment.orElse(null)`. */
                    fun nonPayment(nonPayment: Optional<NonPayment>) =
                        nonPayment(nonPayment.getOrNull())

                    /**
                     * Sets [Builder.nonPayment] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.nonPayment] with a well-typed [NonPayment]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun nonPayment(nonPayment: JsonField<NonPayment>) = apply {
                        this.nonPayment = nonPayment
                    }

                    /** Fields specific to payment authentication attempts. */
                    fun payment(payment: Payment?) = payment(JsonField.ofNullable(payment))

                    /** Alias for calling [Builder.payment] with `payment.orElse(null)`. */
                    fun payment(payment: Optional<Payment>) = payment(payment.getOrNull())

                    /**
                     * Sets [Builder.payment] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.payment] with a well-typed [Payment] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun payment(payment: JsonField<Payment>) = apply { this.payment = payment }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [MessageCategory].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .category()
                     * .nonPayment()
                     * .payment()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): MessageCategory =
                        MessageCategory(
                            checkRequired("category", category),
                            checkRequired("nonPayment", nonPayment),
                            checkRequired("payment", payment),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): MessageCategory = apply {
                    if (validated) {
                        return@apply
                    }

                    category().validate()
                    nonPayment().ifPresent { it.validate() }
                    payment().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (category.asKnown().getOrNull()?.validity() ?: 0) +
                        (nonPayment.asKnown().getOrNull()?.validity() ?: 0) +
                        (payment.asKnown().getOrNull()?.validity() ?: 0)

                /** The category of the card authentication attempt. */
                class Category
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** The authentication attempt is for a payment. */
                        @JvmField val PAYMENT_AUTHENTICATION = of("payment_authentication")

                        /** The authentication attempt is not for a payment. */
                        @JvmField val NON_PAYMENT_AUTHENTICATION = of("non_payment_authentication")

                        @JvmStatic fun of(value: String) = Category(JsonField.of(value))
                    }

                    /** An enum containing [Category]'s known values. */
                    enum class Known {
                        /** The authentication attempt is for a payment. */
                        PAYMENT_AUTHENTICATION,
                        /** The authentication attempt is not for a payment. */
                        NON_PAYMENT_AUTHENTICATION,
                    }

                    /**
                     * An enum containing [Category]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Category] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** The authentication attempt is for a payment. */
                        PAYMENT_AUTHENTICATION,
                        /** The authentication attempt is not for a payment. */
                        NON_PAYMENT_AUTHENTICATION,
                        /**
                         * An enum member indicating that [Category] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            PAYMENT_AUTHENTICATION -> Value.PAYMENT_AUTHENTICATION
                            NON_PAYMENT_AUTHENTICATION -> Value.NON_PAYMENT_AUTHENTICATION
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            PAYMENT_AUTHENTICATION -> Known.PAYMENT_AUTHENTICATION
                            NON_PAYMENT_AUTHENTICATION -> Known.NON_PAYMENT_AUTHENTICATION
                            else -> throw IncreaseInvalidDataException("Unknown Category: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Category = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Category && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** Fields specific to non-payment authentication attempts. */
                class NonPayment
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val additionalProperties: MutableMap<String, JsonValue>
                ) {

                    @JsonCreator private constructor() : this(mutableMapOf())

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [NonPayment].
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [NonPayment]. */
                    class Builder internal constructor() {

                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(nonPayment: NonPayment) = apply {
                            additionalProperties = nonPayment.additionalProperties.toMutableMap()
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [NonPayment].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         */
                        fun build(): NonPayment = NonPayment(additionalProperties.toMutableMap())
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): NonPayment = apply {
                        if (validated) {
                            return@apply
                        }

                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic internal fun validity(): Int = 0

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is NonPayment &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy { Objects.hash(additionalProperties) }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "NonPayment{additionalProperties=$additionalProperties}"
                }

                /** Fields specific to payment authentication attempts. */
                class Payment
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val purchaseAmount: JsonField<Long>,
                    private val purchaseAmountCardholderEstimated: JsonField<Long>,
                    private val purchaseCurrency: JsonField<String>,
                    private val transactionType: JsonField<TransactionType>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("purchase_amount")
                        @ExcludeMissing
                        purchaseAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("purchase_amount_cardholder_estimated")
                        @ExcludeMissing
                        purchaseAmountCardholderEstimated: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("purchase_currency")
                        @ExcludeMissing
                        purchaseCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("transaction_type")
                        @ExcludeMissing
                        transactionType: JsonField<TransactionType> = JsonMissing.of(),
                    ) : this(
                        purchaseAmount,
                        purchaseAmountCardholderEstimated,
                        purchaseCurrency,
                        transactionType,
                        mutableMapOf(),
                    )

                    /**
                     * The purchase amount in minor units.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun purchaseAmount(): Long = purchaseAmount.getRequired("purchase_amount")

                    /**
                     * The purchase amount in the cardholder's currency (i.e., USD) estimated using
                     * daily conversion rates from the card network.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun purchaseAmountCardholderEstimated(): Optional<Long> =
                        purchaseAmountCardholderEstimated.getOptional(
                            "purchase_amount_cardholder_estimated"
                        )

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * authentication attempt's purchase currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun purchaseCurrency(): String =
                        purchaseCurrency.getRequired("purchase_currency")

                    /**
                     * The type of transaction being authenticated.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun transactionType(): Optional<TransactionType> =
                        transactionType.getOptional("transaction_type")

                    /**
                     * Returns the raw JSON value of [purchaseAmount].
                     *
                     * Unlike [purchaseAmount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("purchase_amount")
                    @ExcludeMissing
                    fun _purchaseAmount(): JsonField<Long> = purchaseAmount

                    /**
                     * Returns the raw JSON value of [purchaseAmountCardholderEstimated].
                     *
                     * Unlike [purchaseAmountCardholderEstimated], this method doesn't throw if the
                     * JSON field has an unexpected type.
                     */
                    @JsonProperty("purchase_amount_cardholder_estimated")
                    @ExcludeMissing
                    fun _purchaseAmountCardholderEstimated(): JsonField<Long> =
                        purchaseAmountCardholderEstimated

                    /**
                     * Returns the raw JSON value of [purchaseCurrency].
                     *
                     * Unlike [purchaseCurrency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("purchase_currency")
                    @ExcludeMissing
                    fun _purchaseCurrency(): JsonField<String> = purchaseCurrency

                    /**
                     * Returns the raw JSON value of [transactionType].
                     *
                     * Unlike [transactionType], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("transaction_type")
                    @ExcludeMissing
                    fun _transactionType(): JsonField<TransactionType> = transactionType

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Payment].
                         *
                         * The following fields are required:
                         * ```java
                         * .purchaseAmount()
                         * .purchaseAmountCardholderEstimated()
                         * .purchaseCurrency()
                         * .transactionType()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Payment]. */
                    class Builder internal constructor() {

                        private var purchaseAmount: JsonField<Long>? = null
                        private var purchaseAmountCardholderEstimated: JsonField<Long>? = null
                        private var purchaseCurrency: JsonField<String>? = null
                        private var transactionType: JsonField<TransactionType>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(payment: Payment) = apply {
                            purchaseAmount = payment.purchaseAmount
                            purchaseAmountCardholderEstimated =
                                payment.purchaseAmountCardholderEstimated
                            purchaseCurrency = payment.purchaseCurrency
                            transactionType = payment.transactionType
                            additionalProperties = payment.additionalProperties.toMutableMap()
                        }

                        /** The purchase amount in minor units. */
                        fun purchaseAmount(purchaseAmount: Long) =
                            purchaseAmount(JsonField.of(purchaseAmount))

                        /**
                         * Sets [Builder.purchaseAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.purchaseAmount] with a well-typed [Long]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun purchaseAmount(purchaseAmount: JsonField<Long>) = apply {
                            this.purchaseAmount = purchaseAmount
                        }

                        /**
                         * The purchase amount in the cardholder's currency (i.e., USD) estimated
                         * using daily conversion rates from the card network.
                         */
                        fun purchaseAmountCardholderEstimated(
                            purchaseAmountCardholderEstimated: Long?
                        ) =
                            purchaseAmountCardholderEstimated(
                                JsonField.ofNullable(purchaseAmountCardholderEstimated)
                            )

                        /**
                         * Alias for [Builder.purchaseAmountCardholderEstimated].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun purchaseAmountCardholderEstimated(
                            purchaseAmountCardholderEstimated: Long
                        ) =
                            purchaseAmountCardholderEstimated(
                                purchaseAmountCardholderEstimated as Long?
                            )

                        /**
                         * Alias for calling [Builder.purchaseAmountCardholderEstimated] with
                         * `purchaseAmountCardholderEstimated.orElse(null)`.
                         */
                        fun purchaseAmountCardholderEstimated(
                            purchaseAmountCardholderEstimated: Optional<Long>
                        ) =
                            purchaseAmountCardholderEstimated(
                                purchaseAmountCardholderEstimated.getOrNull()
                            )

                        /**
                         * Sets [Builder.purchaseAmountCardholderEstimated] to an arbitrary JSON
                         * value.
                         *
                         * You should usually call [Builder.purchaseAmountCardholderEstimated] with
                         * a well-typed [Long] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun purchaseAmountCardholderEstimated(
                            purchaseAmountCardholderEstimated: JsonField<Long>
                        ) = apply {
                            this.purchaseAmountCardholderEstimated =
                                purchaseAmountCardholderEstimated
                        }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * authentication attempt's purchase currency.
                         */
                        fun purchaseCurrency(purchaseCurrency: String) =
                            purchaseCurrency(JsonField.of(purchaseCurrency))

                        /**
                         * Sets [Builder.purchaseCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.purchaseCurrency] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun purchaseCurrency(purchaseCurrency: JsonField<String>) = apply {
                            this.purchaseCurrency = purchaseCurrency
                        }

                        /** The type of transaction being authenticated. */
                        fun transactionType(transactionType: TransactionType?) =
                            transactionType(JsonField.ofNullable(transactionType))

                        /**
                         * Alias for calling [Builder.transactionType] with
                         * `transactionType.orElse(null)`.
                         */
                        fun transactionType(transactionType: Optional<TransactionType>) =
                            transactionType(transactionType.getOrNull())

                        /**
                         * Sets [Builder.transactionType] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.transactionType] with a well-typed
                         * [TransactionType] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun transactionType(transactionType: JsonField<TransactionType>) = apply {
                            this.transactionType = transactionType
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Payment].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .purchaseAmount()
                         * .purchaseAmountCardholderEstimated()
                         * .purchaseCurrency()
                         * .transactionType()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Payment =
                            Payment(
                                checkRequired("purchaseAmount", purchaseAmount),
                                checkRequired(
                                    "purchaseAmountCardholderEstimated",
                                    purchaseAmountCardholderEstimated,
                                ),
                                checkRequired("purchaseCurrency", purchaseCurrency),
                                checkRequired("transactionType", transactionType),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Payment = apply {
                        if (validated) {
                            return@apply
                        }

                        purchaseAmount()
                        purchaseAmountCardholderEstimated()
                        purchaseCurrency()
                        transactionType().ifPresent { it.validate() }
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (purchaseAmount.asKnown().isPresent) 1 else 0) +
                            (if (purchaseAmountCardholderEstimated.asKnown().isPresent) 1 else 0) +
                            (if (purchaseCurrency.asKnown().isPresent) 1 else 0) +
                            (transactionType.asKnown().getOrNull()?.validity() ?: 0)

                    /** The type of transaction being authenticated. */
                    class TransactionType
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Purchase of goods or services. */
                            @JvmField val GOODS_SERVICE_PURCHASE = of("goods_service_purchase")

                            /** Check acceptance. */
                            @JvmField val CHECK_ACCEPTANCE = of("check_acceptance")

                            /** Account funding. */
                            @JvmField val ACCOUNT_FUNDING = of("account_funding")

                            /** Quasi-cash transaction. */
                            @JvmField val QUASI_CASH_TRANSACTION = of("quasi_cash_transaction")

                            /** Prepaid activation and load. */
                            @JvmField
                            val PREPAID_ACTIVATION_AND_LOAD = of("prepaid_activation_and_load")

                            @JvmStatic fun of(value: String) = TransactionType(JsonField.of(value))
                        }

                        /** An enum containing [TransactionType]'s known values. */
                        enum class Known {
                            /** Purchase of goods or services. */
                            GOODS_SERVICE_PURCHASE,
                            /** Check acceptance. */
                            CHECK_ACCEPTANCE,
                            /** Account funding. */
                            ACCOUNT_FUNDING,
                            /** Quasi-cash transaction. */
                            QUASI_CASH_TRANSACTION,
                            /** Prepaid activation and load. */
                            PREPAID_ACTIVATION_AND_LOAD,
                        }

                        /**
                         * An enum containing [TransactionType]'s known values, as well as an
                         * [_UNKNOWN] member.
                         *
                         * An instance of [TransactionType] can contain an unknown value in a couple
                         * of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Purchase of goods or services. */
                            GOODS_SERVICE_PURCHASE,
                            /** Check acceptance. */
                            CHECK_ACCEPTANCE,
                            /** Account funding. */
                            ACCOUNT_FUNDING,
                            /** Quasi-cash transaction. */
                            QUASI_CASH_TRANSACTION,
                            /** Prepaid activation and load. */
                            PREPAID_ACTIVATION_AND_LOAD,
                            /**
                             * An enum member indicating that [TransactionType] was instantiated
                             * with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                GOODS_SERVICE_PURCHASE -> Value.GOODS_SERVICE_PURCHASE
                                CHECK_ACCEPTANCE -> Value.CHECK_ACCEPTANCE
                                ACCOUNT_FUNDING -> Value.ACCOUNT_FUNDING
                                QUASI_CASH_TRANSACTION -> Value.QUASI_CASH_TRANSACTION
                                PREPAID_ACTIVATION_AND_LOAD -> Value.PREPAID_ACTIVATION_AND_LOAD
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                GOODS_SERVICE_PURCHASE -> Known.GOODS_SERVICE_PURCHASE
                                CHECK_ACCEPTANCE -> Known.CHECK_ACCEPTANCE
                                ACCOUNT_FUNDING -> Known.ACCOUNT_FUNDING
                                QUASI_CASH_TRANSACTION -> Known.QUASI_CASH_TRANSACTION
                                PREPAID_ACTIVATION_AND_LOAD -> Known.PREPAID_ACTIVATION_AND_LOAD
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown TransactionType: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): TransactionType = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is TransactionType && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Payment &&
                            purchaseAmount == other.purchaseAmount &&
                            purchaseAmountCardholderEstimated ==
                                other.purchaseAmountCardholderEstimated &&
                            purchaseCurrency == other.purchaseCurrency &&
                            transactionType == other.transactionType &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            purchaseAmount,
                            purchaseAmountCardholderEstimated,
                            purchaseCurrency,
                            transactionType,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Payment{purchaseAmount=$purchaseAmount, purchaseAmountCardholderEstimated=$purchaseAmountCardholderEstimated, purchaseCurrency=$purchaseCurrency, transactionType=$transactionType, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is MessageCategory &&
                        category == other.category &&
                        nonPayment == other.nonPayment &&
                        payment == other.payment &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(category, nonPayment, payment, additionalProperties)
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "MessageCategory{category=$category, nonPayment=$nonPayment, payment=$payment, additionalProperties=$additionalProperties}"
            }

            /**
             * The 3DS requestor authentication indicator describes why the authentication attempt
             * is performed, such as for a recurring transaction.
             */
            class RequestorAuthenticationIndicator
            @JsonCreator
            private constructor(private val value: JsonField<String>) : Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** The authentication is for a payment transaction. */
                    @JvmField val PAYMENT_TRANSACTION = of("payment_transaction")

                    /** The authentication is for a recurring transaction. */
                    @JvmField val RECURRING_TRANSACTION = of("recurring_transaction")

                    /** The authentication is for an installment transaction. */
                    @JvmField val INSTALLMENT_TRANSACTION = of("installment_transaction")

                    /** The authentication is for adding a card. */
                    @JvmField val ADD_CARD = of("add_card")

                    /** The authentication is for maintaining a card. */
                    @JvmField val MAINTAIN_CARD = of("maintain_card")

                    /** The authentication is for EMV token cardholder verification. */
                    @JvmField
                    val EMV_TOKEN_CARDHOLDER_VERIFICATION = of("emv_token_cardholder_verification")

                    /** The authentication is for a billing agreement. */
                    @JvmField val BILLING_AGREEMENT = of("billing_agreement")

                    @JvmStatic
                    fun of(value: String) = RequestorAuthenticationIndicator(JsonField.of(value))
                }

                /** An enum containing [RequestorAuthenticationIndicator]'s known values. */
                enum class Known {
                    /** The authentication is for a payment transaction. */
                    PAYMENT_TRANSACTION,
                    /** The authentication is for a recurring transaction. */
                    RECURRING_TRANSACTION,
                    /** The authentication is for an installment transaction. */
                    INSTALLMENT_TRANSACTION,
                    /** The authentication is for adding a card. */
                    ADD_CARD,
                    /** The authentication is for maintaining a card. */
                    MAINTAIN_CARD,
                    /** The authentication is for EMV token cardholder verification. */
                    EMV_TOKEN_CARDHOLDER_VERIFICATION,
                    /** The authentication is for a billing agreement. */
                    BILLING_AGREEMENT,
                }

                /**
                 * An enum containing [RequestorAuthenticationIndicator]'s known values, as well as
                 * an [_UNKNOWN] member.
                 *
                 * An instance of [RequestorAuthenticationIndicator] can contain an unknown value in
                 * a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** The authentication is for a payment transaction. */
                    PAYMENT_TRANSACTION,
                    /** The authentication is for a recurring transaction. */
                    RECURRING_TRANSACTION,
                    /** The authentication is for an installment transaction. */
                    INSTALLMENT_TRANSACTION,
                    /** The authentication is for adding a card. */
                    ADD_CARD,
                    /** The authentication is for maintaining a card. */
                    MAINTAIN_CARD,
                    /** The authentication is for EMV token cardholder verification. */
                    EMV_TOKEN_CARDHOLDER_VERIFICATION,
                    /** The authentication is for a billing agreement. */
                    BILLING_AGREEMENT,
                    /**
                     * An enum member indicating that [RequestorAuthenticationIndicator] was
                     * instantiated with an unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        PAYMENT_TRANSACTION -> Value.PAYMENT_TRANSACTION
                        RECURRING_TRANSACTION -> Value.RECURRING_TRANSACTION
                        INSTALLMENT_TRANSACTION -> Value.INSTALLMENT_TRANSACTION
                        ADD_CARD -> Value.ADD_CARD
                        MAINTAIN_CARD -> Value.MAINTAIN_CARD
                        EMV_TOKEN_CARDHOLDER_VERIFICATION -> Value.EMV_TOKEN_CARDHOLDER_VERIFICATION
                        BILLING_AGREEMENT -> Value.BILLING_AGREEMENT
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        PAYMENT_TRANSACTION -> Known.PAYMENT_TRANSACTION
                        RECURRING_TRANSACTION -> Known.RECURRING_TRANSACTION
                        INSTALLMENT_TRANSACTION -> Known.INSTALLMENT_TRANSACTION
                        ADD_CARD -> Known.ADD_CARD
                        MAINTAIN_CARD -> Known.MAINTAIN_CARD
                        EMV_TOKEN_CARDHOLDER_VERIFICATION -> Known.EMV_TOKEN_CARDHOLDER_VERIFICATION
                        BILLING_AGREEMENT -> Known.BILLING_AGREEMENT
                        else ->
                            throw IncreaseInvalidDataException(
                                "Unknown RequestorAuthenticationIndicator: $value"
                            )
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): RequestorAuthenticationIndicator = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is RequestorAuthenticationIndicator && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** Indicates whether a challenge is requested for this transaction. */
            class RequestorChallengeIndicator
            @JsonCreator
            private constructor(private val value: JsonField<String>) : Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** No preference. */
                    @JvmField val NO_PREFERENCE = of("no_preference")

                    /** No challenge requested. */
                    @JvmField val NO_CHALLENGE_REQUESTED = of("no_challenge_requested")

                    /** Challenge requested, 3DS Requestor preference. */
                    @JvmField
                    val CHALLENGE_REQUESTED_3DS_REQUESTOR_PREFERENCE =
                        of("challenge_requested_3ds_requestor_preference")

                    /** Challenge requested, mandate. */
                    @JvmField val CHALLENGE_REQUESTED_MANDATE = of("challenge_requested_mandate")

                    /** No challenge requested, transactional risk analysis already performed. */
                    @JvmField
                    val NO_CHALLENGE_REQUESTED_TRANSACTIONAL_RISK_ANALYSIS_ALREADY_PERFORMED =
                        of("no_challenge_requested_transactional_risk_analysis_already_performed")

                    /** No challenge requested, data share only. */
                    @JvmField
                    val NO_CHALLENGE_REQUESTED_DATA_SHARE_ONLY =
                        of("no_challenge_requested_data_share_only")

                    /** No challenge requested, strong consumer authentication already performed. */
                    @JvmField
                    val NO_CHALLENGE_REQUESTED_STRONG_CONSUMER_AUTHENTICATION_ALREADY_PERFORMED =
                        of(
                            "no_challenge_requested_strong_consumer_authentication_already_performed"
                        )

                    /**
                     * No challenge requested, utilize whitelist exemption if no challenge required.
                     */
                    @JvmField
                    val NO_CHALLENGE_REQUESTED_UTILIZE_WHITELIST_EXEMPTION_IF_NO_CHALLENGE_REQUIRED =
                        of(
                            "no_challenge_requested_utilize_whitelist_exemption_if_no_challenge_required"
                        )

                    /** Challenge requested, whitelist prompt requested if challenge required. */
                    @JvmField
                    val CHALLENGE_REQUESTED_WHITELIST_PROMPT_REQUESTED_IF_CHALLENGE_REQUIRED =
                        of("challenge_requested_whitelist_prompt_requested_if_challenge_required")

                    @JvmStatic
                    fun of(value: String) = RequestorChallengeIndicator(JsonField.of(value))
                }

                /** An enum containing [RequestorChallengeIndicator]'s known values. */
                enum class Known {
                    /** No preference. */
                    NO_PREFERENCE,
                    /** No challenge requested. */
                    NO_CHALLENGE_REQUESTED,
                    /** Challenge requested, 3DS Requestor preference. */
                    CHALLENGE_REQUESTED_3DS_REQUESTOR_PREFERENCE,
                    /** Challenge requested, mandate. */
                    CHALLENGE_REQUESTED_MANDATE,
                    /** No challenge requested, transactional risk analysis already performed. */
                    NO_CHALLENGE_REQUESTED_TRANSACTIONAL_RISK_ANALYSIS_ALREADY_PERFORMED,
                    /** No challenge requested, data share only. */
                    NO_CHALLENGE_REQUESTED_DATA_SHARE_ONLY,
                    /** No challenge requested, strong consumer authentication already performed. */
                    NO_CHALLENGE_REQUESTED_STRONG_CONSUMER_AUTHENTICATION_ALREADY_PERFORMED,
                    /**
                     * No challenge requested, utilize whitelist exemption if no challenge required.
                     */
                    NO_CHALLENGE_REQUESTED_UTILIZE_WHITELIST_EXEMPTION_IF_NO_CHALLENGE_REQUIRED,
                    /** Challenge requested, whitelist prompt requested if challenge required. */
                    CHALLENGE_REQUESTED_WHITELIST_PROMPT_REQUESTED_IF_CHALLENGE_REQUIRED,
                }

                /**
                 * An enum containing [RequestorChallengeIndicator]'s known values, as well as an
                 * [_UNKNOWN] member.
                 *
                 * An instance of [RequestorChallengeIndicator] can contain an unknown value in a
                 * couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** No preference. */
                    NO_PREFERENCE,
                    /** No challenge requested. */
                    NO_CHALLENGE_REQUESTED,
                    /** Challenge requested, 3DS Requestor preference. */
                    CHALLENGE_REQUESTED_3DS_REQUESTOR_PREFERENCE,
                    /** Challenge requested, mandate. */
                    CHALLENGE_REQUESTED_MANDATE,
                    /** No challenge requested, transactional risk analysis already performed. */
                    NO_CHALLENGE_REQUESTED_TRANSACTIONAL_RISK_ANALYSIS_ALREADY_PERFORMED,
                    /** No challenge requested, data share only. */
                    NO_CHALLENGE_REQUESTED_DATA_SHARE_ONLY,
                    /** No challenge requested, strong consumer authentication already performed. */
                    NO_CHALLENGE_REQUESTED_STRONG_CONSUMER_AUTHENTICATION_ALREADY_PERFORMED,
                    /**
                     * No challenge requested, utilize whitelist exemption if no challenge required.
                     */
                    NO_CHALLENGE_REQUESTED_UTILIZE_WHITELIST_EXEMPTION_IF_NO_CHALLENGE_REQUIRED,
                    /** Challenge requested, whitelist prompt requested if challenge required. */
                    CHALLENGE_REQUESTED_WHITELIST_PROMPT_REQUESTED_IF_CHALLENGE_REQUIRED,
                    /**
                     * An enum member indicating that [RequestorChallengeIndicator] was instantiated
                     * with an unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        NO_PREFERENCE -> Value.NO_PREFERENCE
                        NO_CHALLENGE_REQUESTED -> Value.NO_CHALLENGE_REQUESTED
                        CHALLENGE_REQUESTED_3DS_REQUESTOR_PREFERENCE ->
                            Value.CHALLENGE_REQUESTED_3DS_REQUESTOR_PREFERENCE
                        CHALLENGE_REQUESTED_MANDATE -> Value.CHALLENGE_REQUESTED_MANDATE
                        NO_CHALLENGE_REQUESTED_TRANSACTIONAL_RISK_ANALYSIS_ALREADY_PERFORMED ->
                            Value
                                .NO_CHALLENGE_REQUESTED_TRANSACTIONAL_RISK_ANALYSIS_ALREADY_PERFORMED
                        NO_CHALLENGE_REQUESTED_DATA_SHARE_ONLY ->
                            Value.NO_CHALLENGE_REQUESTED_DATA_SHARE_ONLY
                        NO_CHALLENGE_REQUESTED_STRONG_CONSUMER_AUTHENTICATION_ALREADY_PERFORMED ->
                            Value
                                .NO_CHALLENGE_REQUESTED_STRONG_CONSUMER_AUTHENTICATION_ALREADY_PERFORMED
                        NO_CHALLENGE_REQUESTED_UTILIZE_WHITELIST_EXEMPTION_IF_NO_CHALLENGE_REQUIRED ->
                            Value
                                .NO_CHALLENGE_REQUESTED_UTILIZE_WHITELIST_EXEMPTION_IF_NO_CHALLENGE_REQUIRED
                        CHALLENGE_REQUESTED_WHITELIST_PROMPT_REQUESTED_IF_CHALLENGE_REQUIRED ->
                            Value
                                .CHALLENGE_REQUESTED_WHITELIST_PROMPT_REQUESTED_IF_CHALLENGE_REQUIRED
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        NO_PREFERENCE -> Known.NO_PREFERENCE
                        NO_CHALLENGE_REQUESTED -> Known.NO_CHALLENGE_REQUESTED
                        CHALLENGE_REQUESTED_3DS_REQUESTOR_PREFERENCE ->
                            Known.CHALLENGE_REQUESTED_3DS_REQUESTOR_PREFERENCE
                        CHALLENGE_REQUESTED_MANDATE -> Known.CHALLENGE_REQUESTED_MANDATE
                        NO_CHALLENGE_REQUESTED_TRANSACTIONAL_RISK_ANALYSIS_ALREADY_PERFORMED ->
                            Known
                                .NO_CHALLENGE_REQUESTED_TRANSACTIONAL_RISK_ANALYSIS_ALREADY_PERFORMED
                        NO_CHALLENGE_REQUESTED_DATA_SHARE_ONLY ->
                            Known.NO_CHALLENGE_REQUESTED_DATA_SHARE_ONLY
                        NO_CHALLENGE_REQUESTED_STRONG_CONSUMER_AUTHENTICATION_ALREADY_PERFORMED ->
                            Known
                                .NO_CHALLENGE_REQUESTED_STRONG_CONSUMER_AUTHENTICATION_ALREADY_PERFORMED
                        NO_CHALLENGE_REQUESTED_UTILIZE_WHITELIST_EXEMPTION_IF_NO_CHALLENGE_REQUIRED ->
                            Known
                                .NO_CHALLENGE_REQUESTED_UTILIZE_WHITELIST_EXEMPTION_IF_NO_CHALLENGE_REQUIRED
                        CHALLENGE_REQUESTED_WHITELIST_PROMPT_REQUESTED_IF_CHALLENGE_REQUIRED ->
                            Known
                                .CHALLENGE_REQUESTED_WHITELIST_PROMPT_REQUESTED_IF_CHALLENGE_REQUIRED
                        else ->
                            throw IncreaseInvalidDataException(
                                "Unknown RequestorChallengeIndicator: $value"
                            )
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): RequestorChallengeIndicator = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is RequestorChallengeIndicator && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** The status of the card authentication. */
            class Status @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** The authentication attempt was denied. */
                    @JvmField val DENIED = of("denied")

                    /** The authentication attempt was authenticated with a challenge. */
                    @JvmField val AUTHENTICATED_WITH_CHALLENGE = of("authenticated_with_challenge")

                    /** The authentication attempt was authenticated without a challenge. */
                    @JvmField
                    val AUTHENTICATED_WITHOUT_CHALLENGE = of("authenticated_without_challenge")

                    /** The authentication attempt is awaiting a challenge. */
                    @JvmField val AWAITING_CHALLENGE = of("awaiting_challenge")

                    /** The authentication attempt is validating a challenge. */
                    @JvmField val VALIDATING_CHALLENGE = of("validating_challenge")

                    /** The authentication attempt was canceled. */
                    @JvmField val CANCELED = of("canceled")

                    /** The authentication attempt timed out while awaiting a challenge. */
                    @JvmField val TIMED_OUT_AWAITING_CHALLENGE = of("timed_out_awaiting_challenge")

                    /** The authentication attempt errored. */
                    @JvmField val ERRORED = of("errored")

                    /** The authentication attempt exceeded the attempt threshold. */
                    @JvmField val EXCEEDED_ATTEMPT_THRESHOLD = of("exceeded_attempt_threshold")

                    @JvmStatic fun of(value: String) = Status(JsonField.of(value))
                }

                /** An enum containing [Status]'s known values. */
                enum class Known {
                    /** The authentication attempt was denied. */
                    DENIED,
                    /** The authentication attempt was authenticated with a challenge. */
                    AUTHENTICATED_WITH_CHALLENGE,
                    /** The authentication attempt was authenticated without a challenge. */
                    AUTHENTICATED_WITHOUT_CHALLENGE,
                    /** The authentication attempt is awaiting a challenge. */
                    AWAITING_CHALLENGE,
                    /** The authentication attempt is validating a challenge. */
                    VALIDATING_CHALLENGE,
                    /** The authentication attempt was canceled. */
                    CANCELED,
                    /** The authentication attempt timed out while awaiting a challenge. */
                    TIMED_OUT_AWAITING_CHALLENGE,
                    /** The authentication attempt errored. */
                    ERRORED,
                    /** The authentication attempt exceeded the attempt threshold. */
                    EXCEEDED_ATTEMPT_THRESHOLD,
                }

                /**
                 * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Status] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** The authentication attempt was denied. */
                    DENIED,
                    /** The authentication attempt was authenticated with a challenge. */
                    AUTHENTICATED_WITH_CHALLENGE,
                    /** The authentication attempt was authenticated without a challenge. */
                    AUTHENTICATED_WITHOUT_CHALLENGE,
                    /** The authentication attempt is awaiting a challenge. */
                    AWAITING_CHALLENGE,
                    /** The authentication attempt is validating a challenge. */
                    VALIDATING_CHALLENGE,
                    /** The authentication attempt was canceled. */
                    CANCELED,
                    /** The authentication attempt timed out while awaiting a challenge. */
                    TIMED_OUT_AWAITING_CHALLENGE,
                    /** The authentication attempt errored. */
                    ERRORED,
                    /** The authentication attempt exceeded the attempt threshold. */
                    EXCEEDED_ATTEMPT_THRESHOLD,
                    /**
                     * An enum member indicating that [Status] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        DENIED -> Value.DENIED
                        AUTHENTICATED_WITH_CHALLENGE -> Value.AUTHENTICATED_WITH_CHALLENGE
                        AUTHENTICATED_WITHOUT_CHALLENGE -> Value.AUTHENTICATED_WITHOUT_CHALLENGE
                        AWAITING_CHALLENGE -> Value.AWAITING_CHALLENGE
                        VALIDATING_CHALLENGE -> Value.VALIDATING_CHALLENGE
                        CANCELED -> Value.CANCELED
                        TIMED_OUT_AWAITING_CHALLENGE -> Value.TIMED_OUT_AWAITING_CHALLENGE
                        ERRORED -> Value.ERRORED
                        EXCEEDED_ATTEMPT_THRESHOLD -> Value.EXCEEDED_ATTEMPT_THRESHOLD
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        DENIED -> Known.DENIED
                        AUTHENTICATED_WITH_CHALLENGE -> Known.AUTHENTICATED_WITH_CHALLENGE
                        AUTHENTICATED_WITHOUT_CHALLENGE -> Known.AUTHENTICATED_WITHOUT_CHALLENGE
                        AWAITING_CHALLENGE -> Known.AWAITING_CHALLENGE
                        VALIDATING_CHALLENGE -> Known.VALIDATING_CHALLENGE
                        CANCELED -> Known.CANCELED
                        TIMED_OUT_AWAITING_CHALLENGE -> Known.TIMED_OUT_AWAITING_CHALLENGE
                        ERRORED -> Known.ERRORED
                        EXCEEDED_ATTEMPT_THRESHOLD -> Known.EXCEEDED_ATTEMPT_THRESHOLD
                        else -> throw IncreaseInvalidDataException("Unknown Status: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Status = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Status && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_authentication`.
             */
            class Type @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    @JvmField val CARD_AUTHENTICATION = of("card_authentication")

                    @JvmStatic fun of(value: String) = Type(JsonField.of(value))
                }

                /** An enum containing [Type]'s known values. */
                enum class Known {
                    CARD_AUTHENTICATION
                }

                /**
                 * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Type] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    CARD_AUTHENTICATION,
                    /**
                     * An enum member indicating that [Type] was instantiated with an unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        CARD_AUTHENTICATION -> Value.CARD_AUTHENTICATION
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        CARD_AUTHENTICATION -> Known.CARD_AUTHENTICATION
                        else -> throw IncreaseInvalidDataException("Unknown Type: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Type = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Type && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            override fun equals(other: Any?): Boolean {
                if (this === other) {
                    return true
                }

                return other is CardAuthentication &&
                    id == other.id &&
                    accessControlServerTransactionIdentifier ==
                        other.accessControlServerTransactionIdentifier &&
                    billingAddressCity == other.billingAddressCity &&
                    billingAddressCountry == other.billingAddressCountry &&
                    billingAddressLine1 == other.billingAddressLine1 &&
                    billingAddressLine2 == other.billingAddressLine2 &&
                    billingAddressLine3 == other.billingAddressLine3 &&
                    billingAddressPostalCode == other.billingAddressPostalCode &&
                    billingAddressState == other.billingAddressState &&
                    cardId == other.cardId &&
                    cardPaymentId == other.cardPaymentId &&
                    cardholderEmail == other.cardholderEmail &&
                    cardholderName == other.cardholderName &&
                    challenge == other.challenge &&
                    createdAt == other.createdAt &&
                    denyReason == other.denyReason &&
                    deviceChannel == other.deviceChannel &&
                    directoryServerTransactionIdentifier ==
                        other.directoryServerTransactionIdentifier &&
                    merchantAcceptorId == other.merchantAcceptorId &&
                    merchantCategoryCode == other.merchantCategoryCode &&
                    merchantCountry == other.merchantCountry &&
                    merchantName == other.merchantName &&
                    messageCategory == other.messageCategory &&
                    priorAuthenticatedCardPaymentId == other.priorAuthenticatedCardPaymentId &&
                    realTimeDecisionId == other.realTimeDecisionId &&
                    requestorAuthenticationIndicator == other.requestorAuthenticationIndicator &&
                    requestorChallengeIndicator == other.requestorChallengeIndicator &&
                    requestorName == other.requestorName &&
                    requestorUrl == other.requestorUrl &&
                    shippingAddressCity == other.shippingAddressCity &&
                    shippingAddressCountry == other.shippingAddressCountry &&
                    shippingAddressLine1 == other.shippingAddressLine1 &&
                    shippingAddressLine2 == other.shippingAddressLine2 &&
                    shippingAddressLine3 == other.shippingAddressLine3 &&
                    shippingAddressPostalCode == other.shippingAddressPostalCode &&
                    shippingAddressState == other.shippingAddressState &&
                    status == other.status &&
                    threeDSecureServerTransactionIdentifier ==
                        other.threeDSecureServerTransactionIdentifier &&
                    type == other.type &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    id,
                    accessControlServerTransactionIdentifier,
                    billingAddressCity,
                    billingAddressCountry,
                    billingAddressLine1,
                    billingAddressLine2,
                    billingAddressLine3,
                    billingAddressPostalCode,
                    billingAddressState,
                    cardId,
                    cardPaymentId,
                    cardholderEmail,
                    cardholderName,
                    challenge,
                    createdAt,
                    denyReason,
                    deviceChannel,
                    directoryServerTransactionIdentifier,
                    merchantAcceptorId,
                    merchantCategoryCode,
                    merchantCountry,
                    merchantName,
                    messageCategory,
                    priorAuthenticatedCardPaymentId,
                    realTimeDecisionId,
                    requestorAuthenticationIndicator,
                    requestorChallengeIndicator,
                    requestorName,
                    requestorUrl,
                    shippingAddressCity,
                    shippingAddressCountry,
                    shippingAddressLine1,
                    shippingAddressLine2,
                    shippingAddressLine3,
                    shippingAddressPostalCode,
                    shippingAddressState,
                    status,
                    threeDSecureServerTransactionIdentifier,
                    type,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardAuthentication{id=$id, accessControlServerTransactionIdentifier=$accessControlServerTransactionIdentifier, billingAddressCity=$billingAddressCity, billingAddressCountry=$billingAddressCountry, billingAddressLine1=$billingAddressLine1, billingAddressLine2=$billingAddressLine2, billingAddressLine3=$billingAddressLine3, billingAddressPostalCode=$billingAddressPostalCode, billingAddressState=$billingAddressState, cardId=$cardId, cardPaymentId=$cardPaymentId, cardholderEmail=$cardholderEmail, cardholderName=$cardholderName, challenge=$challenge, createdAt=$createdAt, denyReason=$denyReason, deviceChannel=$deviceChannel, directoryServerTransactionIdentifier=$directoryServerTransactionIdentifier, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCountry=$merchantCountry, merchantName=$merchantName, messageCategory=$messageCategory, priorAuthenticatedCardPaymentId=$priorAuthenticatedCardPaymentId, realTimeDecisionId=$realTimeDecisionId, requestorAuthenticationIndicator=$requestorAuthenticationIndicator, requestorChallengeIndicator=$requestorChallengeIndicator, requestorName=$requestorName, requestorUrl=$requestorUrl, shippingAddressCity=$shippingAddressCity, shippingAddressCountry=$shippingAddressCountry, shippingAddressLine1=$shippingAddressLine1, shippingAddressLine2=$shippingAddressLine2, shippingAddressLine3=$shippingAddressLine3, shippingAddressPostalCode=$shippingAddressPostalCode, shippingAddressState=$shippingAddressState, status=$status, threeDSecureServerTransactionIdentifier=$threeDSecureServerTransactionIdentifier, type=$type, additionalProperties=$additionalProperties}"
        }

        /**
         * A Card Authorization object. This field will be present in the JSON response if and only
         * if `category` is equal to `card_authorization`. Card Authorizations are temporary holds
         * placed on a customer's funds with the intent to later clear a transaction.
         */
        class CardAuthorization
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val id: JsonField<String>,
            private val actioner: JsonField<Actioner>,
            private val additionalAmounts: JsonField<AdditionalAmounts>,
            private val amount: JsonField<Long>,
            private val cardPaymentId: JsonField<String>,
            private val currency: JsonField<Currency>,
            private val digitalWalletTokenId: JsonField<String>,
            private val direction: JsonField<Direction>,
            private val expiresAt: JsonField<OffsetDateTime>,
            private val healthcare: JsonField<Healthcare>,
            private val merchantAcceptorId: JsonField<String>,
            private val merchantCategoryCode: JsonField<String>,
            private val merchantCity: JsonField<String>,
            private val merchantCountry: JsonField<String>,
            private val merchantDescriptor: JsonField<String>,
            private val merchantPostalCode: JsonField<String>,
            private val merchantState: JsonField<String>,
            private val networkDetails: JsonField<NetworkDetails>,
            private val networkIdentifiers: JsonField<NetworkIdentifiers>,
            private val networkRiskScore: JsonField<Long>,
            private val pendingTransactionId: JsonField<String>,
            private val physicalCardId: JsonField<String>,
            private val presentmentAmount: JsonField<Long>,
            private val presentmentCurrency: JsonField<String>,
            private val processingCategory: JsonField<ProcessingCategory>,
            private val realTimeDecisionId: JsonField<String>,
            private val schemeFees: JsonField<List<SchemeFee>>,
            private val terminalId: JsonField<String>,
            private val type: JsonField<Type>,
            private val verification: JsonField<Verification>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
                @JsonProperty("actioner")
                @ExcludeMissing
                actioner: JsonField<Actioner> = JsonMissing.of(),
                @JsonProperty("additional_amounts")
                @ExcludeMissing
                additionalAmounts: JsonField<AdditionalAmounts> = JsonMissing.of(),
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("card_payment_id")
                @ExcludeMissing
                cardPaymentId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("digital_wallet_token_id")
                @ExcludeMissing
                digitalWalletTokenId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("direction")
                @ExcludeMissing
                direction: JsonField<Direction> = JsonMissing.of(),
                @JsonProperty("expires_at")
                @ExcludeMissing
                expiresAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                @JsonProperty("healthcare")
                @ExcludeMissing
                healthcare: JsonField<Healthcare> = JsonMissing.of(),
                @JsonProperty("merchant_acceptor_id")
                @ExcludeMissing
                merchantAcceptorId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_category_code")
                @ExcludeMissing
                merchantCategoryCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_city")
                @ExcludeMissing
                merchantCity: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_country")
                @ExcludeMissing
                merchantCountry: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_descriptor")
                @ExcludeMissing
                merchantDescriptor: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_postal_code")
                @ExcludeMissing
                merchantPostalCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_state")
                @ExcludeMissing
                merchantState: JsonField<String> = JsonMissing.of(),
                @JsonProperty("network_details")
                @ExcludeMissing
                networkDetails: JsonField<NetworkDetails> = JsonMissing.of(),
                @JsonProperty("network_identifiers")
                @ExcludeMissing
                networkIdentifiers: JsonField<NetworkIdentifiers> = JsonMissing.of(),
                @JsonProperty("network_risk_score")
                @ExcludeMissing
                networkRiskScore: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("pending_transaction_id")
                @ExcludeMissing
                pendingTransactionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("physical_card_id")
                @ExcludeMissing
                physicalCardId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("presentment_amount")
                @ExcludeMissing
                presentmentAmount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("presentment_currency")
                @ExcludeMissing
                presentmentCurrency: JsonField<String> = JsonMissing.of(),
                @JsonProperty("processing_category")
                @ExcludeMissing
                processingCategory: JsonField<ProcessingCategory> = JsonMissing.of(),
                @JsonProperty("real_time_decision_id")
                @ExcludeMissing
                realTimeDecisionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("scheme_fees")
                @ExcludeMissing
                schemeFees: JsonField<List<SchemeFee>> = JsonMissing.of(),
                @JsonProperty("terminal_id")
                @ExcludeMissing
                terminalId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
                @JsonProperty("verification")
                @ExcludeMissing
                verification: JsonField<Verification> = JsonMissing.of(),
            ) : this(
                id,
                actioner,
                additionalAmounts,
                amount,
                cardPaymentId,
                currency,
                digitalWalletTokenId,
                direction,
                expiresAt,
                healthcare,
                merchantAcceptorId,
                merchantCategoryCode,
                merchantCity,
                merchantCountry,
                merchantDescriptor,
                merchantPostalCode,
                merchantState,
                networkDetails,
                networkIdentifiers,
                networkRiskScore,
                pendingTransactionId,
                physicalCardId,
                presentmentAmount,
                presentmentCurrency,
                processingCategory,
                realTimeDecisionId,
                schemeFees,
                terminalId,
                type,
                verification,
                mutableMapOf(),
            )

            /**
             * The Card Authorization identifier.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun id(): String = id.getRequired("id")

            /**
             * Whether this authorization was approved by Increase, the card network through
             * stand-in processing, or the user through a real-time decision.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun actioner(): Actioner = actioner.getRequired("actioner")

            /**
             * Additional amounts associated with the card authorization, such as ATM surcharges
             * fees. These are usually a subset of the `amount` field and are used to provide more
             * detailed information about the transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun additionalAmounts(): AdditionalAmounts =
                additionalAmounts.getRequired("additional_amounts")

            /**
             * The pending amount in the minor unit of the transaction's currency. For dollars, for
             * example, this is cents.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun amount(): Long = amount.getRequired("amount")

            /**
             * The ID of the Card Payment this transaction belongs to.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun cardPaymentId(): String = cardPaymentId.getRequired("card_payment_id")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
             * currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun currency(): Currency = currency.getRequired("currency")

            /**
             * If the authorization was made via a Digital Wallet Token (such as an Apple Pay
             * purchase), the identifier of the token that was used.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun digitalWalletTokenId(): Optional<String> =
                digitalWalletTokenId.getOptional("digital_wallet_token_id")

            /**
             * The direction describes the direction the funds will move, either from the cardholder
             * to the merchant or from the merchant to the cardholder.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun direction(): Direction = direction.getRequired("direction")

            /**
             * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) when this authorization will
             * expire and the pending transaction will be released.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun expiresAt(): OffsetDateTime = expiresAt.getRequired("expires_at")

            /**
             * The healthcare-related fields for this authorization. Only present for specific
             * programs.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun healthcare(): Optional<Healthcare> = healthcare.getOptional("healthcare")

            /**
             * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantAcceptorId(): String =
                merchantAcceptorId.getRequired("merchant_acceptor_id")

            /**
             * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCategoryCode(): String =
                merchantCategoryCode.getRequired("merchant_category_code")

            /**
             * The city the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantCity(): Optional<String> = merchantCity.getOptional("merchant_city")

            /**
             * The country the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCountry(): String = merchantCountry.getRequired("merchant_country")

            /**
             * The merchant descriptor of the merchant the card is transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantDescriptor(): String = merchantDescriptor.getRequired("merchant_descriptor")

            /**
             * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit ZIP
             * code, where the first 5 and last 4 are separated by a dash.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantPostalCode(): Optional<String> =
                merchantPostalCode.getOptional("merchant_postal_code")

            /**
             * The state the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantState(): Optional<String> = merchantState.getOptional("merchant_state")

            /**
             * Fields specific to the `network`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details")

            /**
             * Network-specific identifiers for a specific request or transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun networkIdentifiers(): NetworkIdentifiers =
                networkIdentifiers.getRequired("network_identifiers")

            /**
             * The risk score generated by the card network. For Visa this is the Visa Advanced
             * Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the score
             * is from 0 to 999, where 999 is the riskiest.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun networkRiskScore(): Optional<Long> =
                networkRiskScore.getOptional("network_risk_score")

            /**
             * The identifier of the Pending Transaction associated with this Transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun pendingTransactionId(): Optional<String> =
                pendingTransactionId.getOptional("pending_transaction_id")

            /**
             * If the authorization was made in-person with a physical card, the Physical Card that
             * was used.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun physicalCardId(): Optional<String> = physicalCardId.getOptional("physical_card_id")

            /**
             * The pending amount in the minor unit of the transaction's presentment currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun presentmentAmount(): Long = presentmentAmount.getRequired("presentment_amount")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
             * presentment currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun presentmentCurrency(): String =
                presentmentCurrency.getRequired("presentment_currency")

            /**
             * The processing category describes the intent behind the authorization, such as
             * whether it was used for bill payments or an automatic fuel dispenser.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun processingCategory(): ProcessingCategory =
                processingCategory.getRequired("processing_category")

            /**
             * The identifier of the Real-Time Decision sent to approve or decline this transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun realTimeDecisionId(): Optional<String> =
                realTimeDecisionId.getOptional("real_time_decision_id")

            /**
             * The scheme fees associated with this card authorization.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun schemeFees(): List<SchemeFee> = schemeFees.getRequired("scheme_fees")

            /**
             * The terminal identifier (commonly abbreviated as TID) of the terminal the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun terminalId(): Optional<String> = terminalId.getOptional("terminal_id")

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_authorization`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun type(): Type = type.getRequired("type")

            /**
             * Fields related to verification of cardholder-provided values.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun verification(): Verification = verification.getRequired("verification")

            /**
             * Returns the raw JSON value of [id].
             *
             * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id

            /**
             * Returns the raw JSON value of [actioner].
             *
             * Unlike [actioner], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("actioner")
            @ExcludeMissing
            fun _actioner(): JsonField<Actioner> = actioner

            /**
             * Returns the raw JSON value of [additionalAmounts].
             *
             * Unlike [additionalAmounts], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("additional_amounts")
            @ExcludeMissing
            fun _additionalAmounts(): JsonField<AdditionalAmounts> = additionalAmounts

            /**
             * Returns the raw JSON value of [amount].
             *
             * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

            /**
             * Returns the raw JSON value of [cardPaymentId].
             *
             * Unlike [cardPaymentId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("card_payment_id")
            @ExcludeMissing
            fun _cardPaymentId(): JsonField<String> = cardPaymentId

            /**
             * Returns the raw JSON value of [currency].
             *
             * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("currency")
            @ExcludeMissing
            fun _currency(): JsonField<Currency> = currency

            /**
             * Returns the raw JSON value of [digitalWalletTokenId].
             *
             * Unlike [digitalWalletTokenId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("digital_wallet_token_id")
            @ExcludeMissing
            fun _digitalWalletTokenId(): JsonField<String> = digitalWalletTokenId

            /**
             * Returns the raw JSON value of [direction].
             *
             * Unlike [direction], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("direction")
            @ExcludeMissing
            fun _direction(): JsonField<Direction> = direction

            /**
             * Returns the raw JSON value of [expiresAt].
             *
             * Unlike [expiresAt], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("expires_at")
            @ExcludeMissing
            fun _expiresAt(): JsonField<OffsetDateTime> = expiresAt

            /**
             * Returns the raw JSON value of [healthcare].
             *
             * Unlike [healthcare], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("healthcare")
            @ExcludeMissing
            fun _healthcare(): JsonField<Healthcare> = healthcare

            /**
             * Returns the raw JSON value of [merchantAcceptorId].
             *
             * Unlike [merchantAcceptorId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_acceptor_id")
            @ExcludeMissing
            fun _merchantAcceptorId(): JsonField<String> = merchantAcceptorId

            /**
             * Returns the raw JSON value of [merchantCategoryCode].
             *
             * Unlike [merchantCategoryCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_category_code")
            @ExcludeMissing
            fun _merchantCategoryCode(): JsonField<String> = merchantCategoryCode

            /**
             * Returns the raw JSON value of [merchantCity].
             *
             * Unlike [merchantCity], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_city")
            @ExcludeMissing
            fun _merchantCity(): JsonField<String> = merchantCity

            /**
             * Returns the raw JSON value of [merchantCountry].
             *
             * Unlike [merchantCountry], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_country")
            @ExcludeMissing
            fun _merchantCountry(): JsonField<String> = merchantCountry

            /**
             * Returns the raw JSON value of [merchantDescriptor].
             *
             * Unlike [merchantDescriptor], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_descriptor")
            @ExcludeMissing
            fun _merchantDescriptor(): JsonField<String> = merchantDescriptor

            /**
             * Returns the raw JSON value of [merchantPostalCode].
             *
             * Unlike [merchantPostalCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_postal_code")
            @ExcludeMissing
            fun _merchantPostalCode(): JsonField<String> = merchantPostalCode

            /**
             * Returns the raw JSON value of [merchantState].
             *
             * Unlike [merchantState], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_state")
            @ExcludeMissing
            fun _merchantState(): JsonField<String> = merchantState

            /**
             * Returns the raw JSON value of [networkDetails].
             *
             * Unlike [networkDetails], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_details")
            @ExcludeMissing
            fun _networkDetails(): JsonField<NetworkDetails> = networkDetails

            /**
             * Returns the raw JSON value of [networkIdentifiers].
             *
             * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_identifiers")
            @ExcludeMissing
            fun _networkIdentifiers(): JsonField<NetworkIdentifiers> = networkIdentifiers

            /**
             * Returns the raw JSON value of [networkRiskScore].
             *
             * Unlike [networkRiskScore], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_risk_score")
            @ExcludeMissing
            fun _networkRiskScore(): JsonField<Long> = networkRiskScore

            /**
             * Returns the raw JSON value of [pendingTransactionId].
             *
             * Unlike [pendingTransactionId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("pending_transaction_id")
            @ExcludeMissing
            fun _pendingTransactionId(): JsonField<String> = pendingTransactionId

            /**
             * Returns the raw JSON value of [physicalCardId].
             *
             * Unlike [physicalCardId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("physical_card_id")
            @ExcludeMissing
            fun _physicalCardId(): JsonField<String> = physicalCardId

            /**
             * Returns the raw JSON value of [presentmentAmount].
             *
             * Unlike [presentmentAmount], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("presentment_amount")
            @ExcludeMissing
            fun _presentmentAmount(): JsonField<Long> = presentmentAmount

            /**
             * Returns the raw JSON value of [presentmentCurrency].
             *
             * Unlike [presentmentCurrency], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("presentment_currency")
            @ExcludeMissing
            fun _presentmentCurrency(): JsonField<String> = presentmentCurrency

            /**
             * Returns the raw JSON value of [processingCategory].
             *
             * Unlike [processingCategory], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("processing_category")
            @ExcludeMissing
            fun _processingCategory(): JsonField<ProcessingCategory> = processingCategory

            /**
             * Returns the raw JSON value of [realTimeDecisionId].
             *
             * Unlike [realTimeDecisionId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("real_time_decision_id")
            @ExcludeMissing
            fun _realTimeDecisionId(): JsonField<String> = realTimeDecisionId

            /**
             * Returns the raw JSON value of [schemeFees].
             *
             * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("scheme_fees")
            @ExcludeMissing
            fun _schemeFees(): JsonField<List<SchemeFee>> = schemeFees

            /**
             * Returns the raw JSON value of [terminalId].
             *
             * Unlike [terminalId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("terminal_id")
            @ExcludeMissing
            fun _terminalId(): JsonField<String> = terminalId

            /**
             * Returns the raw JSON value of [type].
             *
             * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("type") @ExcludeMissing fun _type(): JsonField<Type> = type

            /**
             * Returns the raw JSON value of [verification].
             *
             * Unlike [verification], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("verification")
            @ExcludeMissing
            fun _verification(): JsonField<Verification> = verification

            @JsonAnySetter
            private fun putAdditionalProperty(key: String, value: JsonValue) {
                additionalProperties.put(key, value)
            }

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map<String, JsonValue> =
                Collections.unmodifiableMap(additionalProperties)

            fun toBuilder() = Builder().from(this)

            companion object {

                /**
                 * Returns a mutable builder for constructing an instance of [CardAuthorization].
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .actioner()
                 * .additionalAmounts()
                 * .amount()
                 * .cardPaymentId()
                 * .currency()
                 * .digitalWalletTokenId()
                 * .direction()
                 * .expiresAt()
                 * .healthcare()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCity()
                 * .merchantCountry()
                 * .merchantDescriptor()
                 * .merchantPostalCode()
                 * .merchantState()
                 * .networkDetails()
                 * .networkIdentifiers()
                 * .networkRiskScore()
                 * .pendingTransactionId()
                 * .physicalCardId()
                 * .presentmentAmount()
                 * .presentmentCurrency()
                 * .processingCategory()
                 * .realTimeDecisionId()
                 * .schemeFees()
                 * .terminalId()
                 * .type()
                 * .verification()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

            /** A builder for [CardAuthorization]. */
            class Builder internal constructor() {

                private var id: JsonField<String>? = null
                private var actioner: JsonField<Actioner>? = null
                private var additionalAmounts: JsonField<AdditionalAmounts>? = null
                private var amount: JsonField<Long>? = null
                private var cardPaymentId: JsonField<String>? = null
                private var currency: JsonField<Currency>? = null
                private var digitalWalletTokenId: JsonField<String>? = null
                private var direction: JsonField<Direction>? = null
                private var expiresAt: JsonField<OffsetDateTime>? = null
                private var healthcare: JsonField<Healthcare>? = null
                private var merchantAcceptorId: JsonField<String>? = null
                private var merchantCategoryCode: JsonField<String>? = null
                private var merchantCity: JsonField<String>? = null
                private var merchantCountry: JsonField<String>? = null
                private var merchantDescriptor: JsonField<String>? = null
                private var merchantPostalCode: JsonField<String>? = null
                private var merchantState: JsonField<String>? = null
                private var networkDetails: JsonField<NetworkDetails>? = null
                private var networkIdentifiers: JsonField<NetworkIdentifiers>? = null
                private var networkRiskScore: JsonField<Long>? = null
                private var pendingTransactionId: JsonField<String>? = null
                private var physicalCardId: JsonField<String>? = null
                private var presentmentAmount: JsonField<Long>? = null
                private var presentmentCurrency: JsonField<String>? = null
                private var processingCategory: JsonField<ProcessingCategory>? = null
                private var realTimeDecisionId: JsonField<String>? = null
                private var schemeFees: JsonField<MutableList<SchemeFee>>? = null
                private var terminalId: JsonField<String>? = null
                private var type: JsonField<Type>? = null
                private var verification: JsonField<Verification>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardAuthorization: CardAuthorization) = apply {
                    id = cardAuthorization.id
                    actioner = cardAuthorization.actioner
                    additionalAmounts = cardAuthorization.additionalAmounts
                    amount = cardAuthorization.amount
                    cardPaymentId = cardAuthorization.cardPaymentId
                    currency = cardAuthorization.currency
                    digitalWalletTokenId = cardAuthorization.digitalWalletTokenId
                    direction = cardAuthorization.direction
                    expiresAt = cardAuthorization.expiresAt
                    healthcare = cardAuthorization.healthcare
                    merchantAcceptorId = cardAuthorization.merchantAcceptorId
                    merchantCategoryCode = cardAuthorization.merchantCategoryCode
                    merchantCity = cardAuthorization.merchantCity
                    merchantCountry = cardAuthorization.merchantCountry
                    merchantDescriptor = cardAuthorization.merchantDescriptor
                    merchantPostalCode = cardAuthorization.merchantPostalCode
                    merchantState = cardAuthorization.merchantState
                    networkDetails = cardAuthorization.networkDetails
                    networkIdentifiers = cardAuthorization.networkIdentifiers
                    networkRiskScore = cardAuthorization.networkRiskScore
                    pendingTransactionId = cardAuthorization.pendingTransactionId
                    physicalCardId = cardAuthorization.physicalCardId
                    presentmentAmount = cardAuthorization.presentmentAmount
                    presentmentCurrency = cardAuthorization.presentmentCurrency
                    processingCategory = cardAuthorization.processingCategory
                    realTimeDecisionId = cardAuthorization.realTimeDecisionId
                    schemeFees = cardAuthorization.schemeFees.map { it.toMutableList() }
                    terminalId = cardAuthorization.terminalId
                    type = cardAuthorization.type
                    verification = cardAuthorization.verification
                    additionalProperties = cardAuthorization.additionalProperties.toMutableMap()
                }

                /** The Card Authorization identifier. */
                fun id(id: String) = id(JsonField.of(id))

                /**
                 * Sets [Builder.id] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.id] with a well-typed [String] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun id(id: JsonField<String>) = apply { this.id = id }

                /**
                 * Whether this authorization was approved by Increase, the card network through
                 * stand-in processing, or the user through a real-time decision.
                 */
                fun actioner(actioner: Actioner) = actioner(JsonField.of(actioner))

                /**
                 * Sets [Builder.actioner] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.actioner] with a well-typed [Actioner] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun actioner(actioner: JsonField<Actioner>) = apply { this.actioner = actioner }

                /**
                 * Additional amounts associated with the card authorization, such as ATM surcharges
                 * fees. These are usually a subset of the `amount` field and are used to provide
                 * more detailed information about the transaction.
                 */
                fun additionalAmounts(additionalAmounts: AdditionalAmounts) =
                    additionalAmounts(JsonField.of(additionalAmounts))

                /**
                 * Sets [Builder.additionalAmounts] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.additionalAmounts] with a well-typed
                 * [AdditionalAmounts] value instead. This method is primarily for setting the field
                 * to an undocumented or not yet supported value.
                 */
                fun additionalAmounts(additionalAmounts: JsonField<AdditionalAmounts>) = apply {
                    this.additionalAmounts = additionalAmounts
                }

                /**
                 * The pending amount in the minor unit of the transaction's currency. For dollars,
                 * for example, this is cents.
                 */
                fun amount(amount: Long) = amount(JsonField.of(amount))

                /**
                 * Sets [Builder.amount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.amount] with a well-typed [Long] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                /** The ID of the Card Payment this transaction belongs to. */
                fun cardPaymentId(cardPaymentId: String) =
                    cardPaymentId(JsonField.of(cardPaymentId))

                /**
                 * Sets [Builder.cardPaymentId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cardPaymentId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun cardPaymentId(cardPaymentId: JsonField<String>) = apply {
                    this.cardPaymentId = cardPaymentId
                }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
                 * currency.
                 */
                fun currency(currency: Currency) = currency(JsonField.of(currency))

                /**
                 * Sets [Builder.currency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.currency] with a well-typed [Currency] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                /**
                 * If the authorization was made via a Digital Wallet Token (such as an Apple Pay
                 * purchase), the identifier of the token that was used.
                 */
                fun digitalWalletTokenId(digitalWalletTokenId: String?) =
                    digitalWalletTokenId(JsonField.ofNullable(digitalWalletTokenId))

                /**
                 * Alias for calling [Builder.digitalWalletTokenId] with
                 * `digitalWalletTokenId.orElse(null)`.
                 */
                fun digitalWalletTokenId(digitalWalletTokenId: Optional<String>) =
                    digitalWalletTokenId(digitalWalletTokenId.getOrNull())

                /**
                 * Sets [Builder.digitalWalletTokenId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.digitalWalletTokenId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun digitalWalletTokenId(digitalWalletTokenId: JsonField<String>) = apply {
                    this.digitalWalletTokenId = digitalWalletTokenId
                }

                /**
                 * The direction describes the direction the funds will move, either from the
                 * cardholder to the merchant or from the merchant to the cardholder.
                 */
                fun direction(direction: Direction) = direction(JsonField.of(direction))

                /**
                 * Sets [Builder.direction] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.direction] with a well-typed [Direction] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun direction(direction: JsonField<Direction>) = apply {
                    this.direction = direction
                }

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) when this authorization
                 * will expire and the pending transaction will be released.
                 */
                fun expiresAt(expiresAt: OffsetDateTime) = expiresAt(JsonField.of(expiresAt))

                /**
                 * Sets [Builder.expiresAt] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.expiresAt] with a well-typed [OffsetDateTime]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun expiresAt(expiresAt: JsonField<OffsetDateTime>) = apply {
                    this.expiresAt = expiresAt
                }

                /**
                 * The healthcare-related fields for this authorization. Only present for specific
                 * programs.
                 */
                fun healthcare(healthcare: Healthcare?) =
                    healthcare(JsonField.ofNullable(healthcare))

                /** Alias for calling [Builder.healthcare] with `healthcare.orElse(null)`. */
                fun healthcare(healthcare: Optional<Healthcare>) =
                    healthcare(healthcare.getOrNull())

                /**
                 * Sets [Builder.healthcare] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.healthcare] with a well-typed [Healthcare] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun healthcare(healthcare: JsonField<Healthcare>) = apply {
                    this.healthcare = healthcare
                }

                /**
                 * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
                 * transacting with.
                 */
                fun merchantAcceptorId(merchantAcceptorId: String) =
                    merchantAcceptorId(JsonField.of(merchantAcceptorId))

                /**
                 * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantAcceptorId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantAcceptorId(merchantAcceptorId: JsonField<String>) = apply {
                    this.merchantAcceptorId = merchantAcceptorId
                }

                /**
                 * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card
                 * is transacting with.
                 */
                fun merchantCategoryCode(merchantCategoryCode: String) =
                    merchantCategoryCode(JsonField.of(merchantCategoryCode))

                /**
                 * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCategoryCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCategoryCode(merchantCategoryCode: JsonField<String>) = apply {
                    this.merchantCategoryCode = merchantCategoryCode
                }

                /** The city the merchant resides in. */
                fun merchantCity(merchantCity: String?) =
                    merchantCity(JsonField.ofNullable(merchantCity))

                /** Alias for calling [Builder.merchantCity] with `merchantCity.orElse(null)`. */
                fun merchantCity(merchantCity: Optional<String>) =
                    merchantCity(merchantCity.getOrNull())

                /**
                 * Sets [Builder.merchantCity] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCity] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantCity(merchantCity: JsonField<String>) = apply {
                    this.merchantCity = merchantCity
                }

                /** The country the merchant resides in. */
                fun merchantCountry(merchantCountry: String) =
                    merchantCountry(JsonField.of(merchantCountry))

                /**
                 * Sets [Builder.merchantCountry] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCountry] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCountry(merchantCountry: JsonField<String>) = apply {
                    this.merchantCountry = merchantCountry
                }

                /** The merchant descriptor of the merchant the card is transacting with. */
                fun merchantDescriptor(merchantDescriptor: String) =
                    merchantDescriptor(JsonField.of(merchantDescriptor))

                /**
                 * Sets [Builder.merchantDescriptor] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantDescriptor] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantDescriptor(merchantDescriptor: JsonField<String>) = apply {
                    this.merchantDescriptor = merchantDescriptor
                }

                /**
                 * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit
                 * ZIP code, where the first 5 and last 4 are separated by a dash.
                 */
                fun merchantPostalCode(merchantPostalCode: String?) =
                    merchantPostalCode(JsonField.ofNullable(merchantPostalCode))

                /**
                 * Alias for calling [Builder.merchantPostalCode] with
                 * `merchantPostalCode.orElse(null)`.
                 */
                fun merchantPostalCode(merchantPostalCode: Optional<String>) =
                    merchantPostalCode(merchantPostalCode.getOrNull())

                /**
                 * Sets [Builder.merchantPostalCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantPostalCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantPostalCode(merchantPostalCode: JsonField<String>) = apply {
                    this.merchantPostalCode = merchantPostalCode
                }

                /** The state the merchant resides in. */
                fun merchantState(merchantState: String?) =
                    merchantState(JsonField.ofNullable(merchantState))

                /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */
                fun merchantState(merchantState: Optional<String>) =
                    merchantState(merchantState.getOrNull())

                /**
                 * Sets [Builder.merchantState] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantState] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantState(merchantState: JsonField<String>) = apply {
                    this.merchantState = merchantState
                }

                /** Fields specific to the `network`. */
                fun networkDetails(networkDetails: NetworkDetails) =
                    networkDetails(JsonField.of(networkDetails))

                /**
                 * Sets [Builder.networkDetails] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkDetails] with a well-typed
                 * [NetworkDetails] value instead. This method is primarily for setting the field to
                 * an undocumented or not yet supported value.
                 */
                fun networkDetails(networkDetails: JsonField<NetworkDetails>) = apply {
                    this.networkDetails = networkDetails
                }

                /** Network-specific identifiers for a specific request or transaction. */
                fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) =
                    networkIdentifiers(JsonField.of(networkIdentifiers))

                /**
                 * Sets [Builder.networkIdentifiers] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkIdentifiers] with a well-typed
                 * [NetworkIdentifiers] value instead. This method is primarily for setting the
                 * field to an undocumented or not yet supported value.
                 */
                fun networkIdentifiers(networkIdentifiers: JsonField<NetworkIdentifiers>) = apply {
                    this.networkIdentifiers = networkIdentifiers
                }

                /**
                 * The risk score generated by the card network. For Visa this is the Visa Advanced
                 * Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the
                 * score is from 0 to 999, where 999 is the riskiest.
                 */
                fun networkRiskScore(networkRiskScore: Long?) =
                    networkRiskScore(JsonField.ofNullable(networkRiskScore))

                /**
                 * Alias for [Builder.networkRiskScore].
                 *
                 * This unboxed primitive overload exists for backwards compatibility.
                 */
                fun networkRiskScore(networkRiskScore: Long) =
                    networkRiskScore(networkRiskScore as Long?)

                /**
                 * Alias for calling [Builder.networkRiskScore] with
                 * `networkRiskScore.orElse(null)`.
                 */
                fun networkRiskScore(networkRiskScore: Optional<Long>) =
                    networkRiskScore(networkRiskScore.getOrNull())

                /**
                 * Sets [Builder.networkRiskScore] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkRiskScore] with a well-typed [Long] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun networkRiskScore(networkRiskScore: JsonField<Long>) = apply {
                    this.networkRiskScore = networkRiskScore
                }

                /** The identifier of the Pending Transaction associated with this Transaction. */
                fun pendingTransactionId(pendingTransactionId: String?) =
                    pendingTransactionId(JsonField.ofNullable(pendingTransactionId))

                /**
                 * Alias for calling [Builder.pendingTransactionId] with
                 * `pendingTransactionId.orElse(null)`.
                 */
                fun pendingTransactionId(pendingTransactionId: Optional<String>) =
                    pendingTransactionId(pendingTransactionId.getOrNull())

                /**
                 * Sets [Builder.pendingTransactionId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.pendingTransactionId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun pendingTransactionId(pendingTransactionId: JsonField<String>) = apply {
                    this.pendingTransactionId = pendingTransactionId
                }

                /**
                 * If the authorization was made in-person with a physical card, the Physical Card
                 * that was used.
                 */
                fun physicalCardId(physicalCardId: String?) =
                    physicalCardId(JsonField.ofNullable(physicalCardId))

                /**
                 * Alias for calling [Builder.physicalCardId] with `physicalCardId.orElse(null)`.
                 */
                fun physicalCardId(physicalCardId: Optional<String>) =
                    physicalCardId(physicalCardId.getOrNull())

                /**
                 * Sets [Builder.physicalCardId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.physicalCardId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun physicalCardId(physicalCardId: JsonField<String>) = apply {
                    this.physicalCardId = physicalCardId
                }

                /**
                 * The pending amount in the minor unit of the transaction's presentment currency.
                 */
                fun presentmentAmount(presentmentAmount: Long) =
                    presentmentAmount(JsonField.of(presentmentAmount))

                /**
                 * Sets [Builder.presentmentAmount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.presentmentAmount] with a well-typed [Long]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun presentmentAmount(presentmentAmount: JsonField<Long>) = apply {
                    this.presentmentAmount = presentmentAmount
                }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
                 * presentment currency.
                 */
                fun presentmentCurrency(presentmentCurrency: String) =
                    presentmentCurrency(JsonField.of(presentmentCurrency))

                /**
                 * Sets [Builder.presentmentCurrency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.presentmentCurrency] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun presentmentCurrency(presentmentCurrency: JsonField<String>) = apply {
                    this.presentmentCurrency = presentmentCurrency
                }

                /**
                 * The processing category describes the intent behind the authorization, such as
                 * whether it was used for bill payments or an automatic fuel dispenser.
                 */
                fun processingCategory(processingCategory: ProcessingCategory) =
                    processingCategory(JsonField.of(processingCategory))

                /**
                 * Sets [Builder.processingCategory] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.processingCategory] with a well-typed
                 * [ProcessingCategory] value instead. This method is primarily for setting the
                 * field to an undocumented or not yet supported value.
                 */
                fun processingCategory(processingCategory: JsonField<ProcessingCategory>) = apply {
                    this.processingCategory = processingCategory
                }

                /**
                 * The identifier of the Real-Time Decision sent to approve or decline this
                 * transaction.
                 */
                fun realTimeDecisionId(realTimeDecisionId: String?) =
                    realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId))

                /**
                 * Alias for calling [Builder.realTimeDecisionId] with
                 * `realTimeDecisionId.orElse(null)`.
                 */
                fun realTimeDecisionId(realTimeDecisionId: Optional<String>) =
                    realTimeDecisionId(realTimeDecisionId.getOrNull())

                /**
                 * Sets [Builder.realTimeDecisionId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.realTimeDecisionId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun realTimeDecisionId(realTimeDecisionId: JsonField<String>) = apply {
                    this.realTimeDecisionId = realTimeDecisionId
                }

                /** The scheme fees associated with this card authorization. */
                fun schemeFees(schemeFees: List<SchemeFee>) = schemeFees(JsonField.of(schemeFees))

                /**
                 * Sets [Builder.schemeFees] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.schemeFees] with a well-typed `List<SchemeFee>`
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun schemeFees(schemeFees: JsonField<List<SchemeFee>>) = apply {
                    this.schemeFees = schemeFees.map { it.toMutableList() }
                }

                /**
                 * Adds a single [SchemeFee] to [schemeFees].
                 *
                 * @throws IllegalStateException if the field was previously set to a non-list.
                 */
                fun addSchemeFee(schemeFee: SchemeFee) = apply {
                    schemeFees =
                        (schemeFees ?: JsonField.of(mutableListOf())).also {
                            checkKnown("schemeFees", it).add(schemeFee)
                        }
                }

                /**
                 * The terminal identifier (commonly abbreviated as TID) of the terminal the card is
                 * transacting with.
                 */
                fun terminalId(terminalId: String?) = terminalId(JsonField.ofNullable(terminalId))

                /** Alias for calling [Builder.terminalId] with `terminalId.orElse(null)`. */
                fun terminalId(terminalId: Optional<String>) = terminalId(terminalId.getOrNull())

                /**
                 * Sets [Builder.terminalId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.terminalId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun terminalId(terminalId: JsonField<String>) = apply {
                    this.terminalId = terminalId
                }

                /**
                 * A constant representing the object's type. For this resource it will always be
                 * `card_authorization`.
                 */
                fun type(type: Type) = type(JsonField.of(type))

                /**
                 * Sets [Builder.type] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.type] with a well-typed [Type] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun type(type: JsonField<Type>) = apply { this.type = type }

                /** Fields related to verification of cardholder-provided values. */
                fun verification(verification: Verification) =
                    verification(JsonField.of(verification))

                /**
                 * Sets [Builder.verification] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.verification] with a well-typed [Verification]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun verification(verification: JsonField<Verification>) = apply {
                    this.verification = verification
                }

                fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                    this.additionalProperties.clear()
                    putAllAdditionalProperties(additionalProperties)
                }

                fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                    additionalProperties.put(key, value)
                }

                fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun removeAdditionalProperty(key: String) = apply {
                    additionalProperties.remove(key)
                }

                fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                    keys.forEach(::removeAdditionalProperty)
                }

                /**
                 * Returns an immutable instance of [CardAuthorization].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .actioner()
                 * .additionalAmounts()
                 * .amount()
                 * .cardPaymentId()
                 * .currency()
                 * .digitalWalletTokenId()
                 * .direction()
                 * .expiresAt()
                 * .healthcare()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCity()
                 * .merchantCountry()
                 * .merchantDescriptor()
                 * .merchantPostalCode()
                 * .merchantState()
                 * .networkDetails()
                 * .networkIdentifiers()
                 * .networkRiskScore()
                 * .pendingTransactionId()
                 * .physicalCardId()
                 * .presentmentAmount()
                 * .presentmentCurrency()
                 * .processingCategory()
                 * .realTimeDecisionId()
                 * .schemeFees()
                 * .terminalId()
                 * .type()
                 * .verification()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardAuthorization =
                    CardAuthorization(
                        checkRequired("id", id),
                        checkRequired("actioner", actioner),
                        checkRequired("additionalAmounts", additionalAmounts),
                        checkRequired("amount", amount),
                        checkRequired("cardPaymentId", cardPaymentId),
                        checkRequired("currency", currency),
                        checkRequired("digitalWalletTokenId", digitalWalletTokenId),
                        checkRequired("direction", direction),
                        checkRequired("expiresAt", expiresAt),
                        checkRequired("healthcare", healthcare),
                        checkRequired("merchantAcceptorId", merchantAcceptorId),
                        checkRequired("merchantCategoryCode", merchantCategoryCode),
                        checkRequired("merchantCity", merchantCity),
                        checkRequired("merchantCountry", merchantCountry),
                        checkRequired("merchantDescriptor", merchantDescriptor),
                        checkRequired("merchantPostalCode", merchantPostalCode),
                        checkRequired("merchantState", merchantState),
                        checkRequired("networkDetails", networkDetails),
                        checkRequired("networkIdentifiers", networkIdentifiers),
                        checkRequired("networkRiskScore", networkRiskScore),
                        checkRequired("pendingTransactionId", pendingTransactionId),
                        checkRequired("physicalCardId", physicalCardId),
                        checkRequired("presentmentAmount", presentmentAmount),
                        checkRequired("presentmentCurrency", presentmentCurrency),
                        checkRequired("processingCategory", processingCategory),
                        checkRequired("realTimeDecisionId", realTimeDecisionId),
                        checkRequired("schemeFees", schemeFees).map { it.toImmutable() },
                        checkRequired("terminalId", terminalId),
                        checkRequired("type", type),
                        checkRequired("verification", verification),
                        additionalProperties.toMutableMap(),
                    )
            }

            private var validated: Boolean = false

            /**
             * Validates that the types of all values in this object match their expected types
             * recursively.
             *
             * This method is _not_ forwards compatible with new types from the API for existing
             * fields.
             *
             * @throws IncreaseInvalidDataException if any value type in this object doesn't match
             *   its expected type.
             */
            fun validate(): CardAuthorization = apply {
                if (validated) {
                    return@apply
                }

                id()
                actioner().validate()
                additionalAmounts().validate()
                amount()
                cardPaymentId()
                currency().validate()
                digitalWalletTokenId()
                direction().validate()
                expiresAt()
                healthcare().ifPresent { it.validate() }
                merchantAcceptorId()
                merchantCategoryCode()
                merchantCity()
                merchantCountry()
                merchantDescriptor()
                merchantPostalCode()
                merchantState()
                networkDetails().validate()
                networkIdentifiers().validate()
                networkRiskScore()
                pendingTransactionId()
                physicalCardId()
                presentmentAmount()
                presentmentCurrency()
                processingCategory().validate()
                realTimeDecisionId()
                schemeFees().forEach { it.validate() }
                terminalId()
                type().validate()
                verification().validate()
                validated = true
            }

            fun isValid(): Boolean =
                try {
                    validate()
                    true
                } catch (e: IncreaseInvalidDataException) {
                    false
                }

            /**
             * Returns a score indicating how many valid values are contained in this object
             * recursively.
             *
             * Used for best match union deserialization.
             */
            @JvmSynthetic
            internal fun validity(): Int =
                (if (id.asKnown().isPresent) 1 else 0) +
                    (actioner.asKnown().getOrNull()?.validity() ?: 0) +
                    (additionalAmounts.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (amount.asKnown().isPresent) 1 else 0) +
                    (if (cardPaymentId.asKnown().isPresent) 1 else 0) +
                    (currency.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (digitalWalletTokenId.asKnown().isPresent) 1 else 0) +
                    (direction.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (expiresAt.asKnown().isPresent) 1 else 0) +
                    (healthcare.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) +
                    (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantCity.asKnown().isPresent) 1 else 0) +
                    (if (merchantCountry.asKnown().isPresent) 1 else 0) +
                    (if (merchantDescriptor.asKnown().isPresent) 1 else 0) +
                    (if (merchantPostalCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantState.asKnown().isPresent) 1 else 0) +
                    (networkDetails.asKnown().getOrNull()?.validity() ?: 0) +
                    (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (networkRiskScore.asKnown().isPresent) 1 else 0) +
                    (if (pendingTransactionId.asKnown().isPresent) 1 else 0) +
                    (if (physicalCardId.asKnown().isPresent) 1 else 0) +
                    (if (presentmentAmount.asKnown().isPresent) 1 else 0) +
                    (if (presentmentCurrency.asKnown().isPresent) 1 else 0) +
                    (processingCategory.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) +
                    (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
                    (if (terminalId.asKnown().isPresent) 1 else 0) +
                    (type.asKnown().getOrNull()?.validity() ?: 0) +
                    (verification.asKnown().getOrNull()?.validity() ?: 0)

            /**
             * Whether this authorization was approved by Increase, the card network through
             * stand-in processing, or the user through a real-time decision.
             */
            class Actioner @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** This object was actioned by the user through a real-time decision. */
                    @JvmField val USER = of("user")

                    /** This object was actioned by Increase without user intervention. */
                    @JvmField val INCREASE = of("increase")

                    /** This object was actioned by the network, through stand-in processing. */
                    @JvmField val NETWORK = of("network")

                    @JvmStatic fun of(value: String) = Actioner(JsonField.of(value))
                }

                /** An enum containing [Actioner]'s known values. */
                enum class Known {
                    /** This object was actioned by the user through a real-time decision. */
                    USER,
                    /** This object was actioned by Increase without user intervention. */
                    INCREASE,
                    /** This object was actioned by the network, through stand-in processing. */
                    NETWORK,
                }

                /**
                 * An enum containing [Actioner]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Actioner] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** This object was actioned by the user through a real-time decision. */
                    USER,
                    /** This object was actioned by Increase without user intervention. */
                    INCREASE,
                    /** This object was actioned by the network, through stand-in processing. */
                    NETWORK,
                    /**
                     * An enum member indicating that [Actioner] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        USER -> Value.USER
                        INCREASE -> Value.INCREASE
                        NETWORK -> Value.NETWORK
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        USER -> Known.USER
                        INCREASE -> Known.INCREASE
                        NETWORK -> Known.NETWORK
                        else -> throw IncreaseInvalidDataException("Unknown Actioner: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Actioner = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Actioner && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /**
             * Additional amounts associated with the card authorization, such as ATM surcharges
             * fees. These are usually a subset of the `amount` field and are used to provide more
             * detailed information about the transaction.
             */
            class AdditionalAmounts
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val clinic: JsonField<Clinic>,
                private val dental: JsonField<Dental>,
                private val original: JsonField<Original>,
                private val prescription: JsonField<Prescription>,
                private val surcharge: JsonField<Surcharge>,
                private val totalCumulative: JsonField<TotalCumulative>,
                private val totalHealthcare: JsonField<TotalHealthcare>,
                private val transit: JsonField<Transit>,
                private val unknown: JsonField<Unknown>,
                private val vision: JsonField<Vision>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("clinic")
                    @ExcludeMissing
                    clinic: JsonField<Clinic> = JsonMissing.of(),
                    @JsonProperty("dental")
                    @ExcludeMissing
                    dental: JsonField<Dental> = JsonMissing.of(),
                    @JsonProperty("original")
                    @ExcludeMissing
                    original: JsonField<Original> = JsonMissing.of(),
                    @JsonProperty("prescription")
                    @ExcludeMissing
                    prescription: JsonField<Prescription> = JsonMissing.of(),
                    @JsonProperty("surcharge")
                    @ExcludeMissing
                    surcharge: JsonField<Surcharge> = JsonMissing.of(),
                    @JsonProperty("total_cumulative")
                    @ExcludeMissing
                    totalCumulative: JsonField<TotalCumulative> = JsonMissing.of(),
                    @JsonProperty("total_healthcare")
                    @ExcludeMissing
                    totalHealthcare: JsonField<TotalHealthcare> = JsonMissing.of(),
                    @JsonProperty("transit")
                    @ExcludeMissing
                    transit: JsonField<Transit> = JsonMissing.of(),
                    @JsonProperty("unknown")
                    @ExcludeMissing
                    unknown: JsonField<Unknown> = JsonMissing.of(),
                    @JsonProperty("vision")
                    @ExcludeMissing
                    vision: JsonField<Vision> = JsonMissing.of(),
                ) : this(
                    clinic,
                    dental,
                    original,
                    prescription,
                    surcharge,
                    totalCumulative,
                    totalHealthcare,
                    transit,
                    unknown,
                    vision,
                    mutableMapOf(),
                )

                /**
                 * The part of this transaction amount that was for clinic-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun clinic(): Optional<Clinic> = clinic.getOptional("clinic")

                /**
                 * The part of this transaction amount that was for dental-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun dental(): Optional<Dental> = dental.getOptional("dental")

                /**
                 * The original pre-authorized amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun original(): Optional<Original> = original.getOptional("original")

                /**
                 * The part of this transaction amount that was for healthcare prescriptions.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun prescription(): Optional<Prescription> =
                    prescription.getOptional("prescription")

                /**
                 * The surcharge amount charged for this transaction by the merchant.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun surcharge(): Optional<Surcharge> = surcharge.getOptional("surcharge")

                /**
                 * The total amount of a series of incremental authorizations, optionally provided.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun totalCumulative(): Optional<TotalCumulative> =
                    totalCumulative.getOptional("total_cumulative")

                /**
                 * The total amount of healthcare-related additional amounts.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun totalHealthcare(): Optional<TotalHealthcare> =
                    totalHealthcare.getOptional("total_healthcare")

                /**
                 * The part of this transaction amount that was for transit-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun transit(): Optional<Transit> = transit.getOptional("transit")

                /**
                 * An unknown additional amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun unknown(): Optional<Unknown> = unknown.getOptional("unknown")

                /**
                 * The part of this transaction amount that was for vision-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun vision(): Optional<Vision> = vision.getOptional("vision")

                /**
                 * Returns the raw JSON value of [clinic].
                 *
                 * Unlike [clinic], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("clinic") @ExcludeMissing fun _clinic(): JsonField<Clinic> = clinic

                /**
                 * Returns the raw JSON value of [dental].
                 *
                 * Unlike [dental], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("dental") @ExcludeMissing fun _dental(): JsonField<Dental> = dental

                /**
                 * Returns the raw JSON value of [original].
                 *
                 * Unlike [original], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("original")
                @ExcludeMissing
                fun _original(): JsonField<Original> = original

                /**
                 * Returns the raw JSON value of [prescription].
                 *
                 * Unlike [prescription], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("prescription")
                @ExcludeMissing
                fun _prescription(): JsonField<Prescription> = prescription

                /**
                 * Returns the raw JSON value of [surcharge].
                 *
                 * Unlike [surcharge], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("surcharge")
                @ExcludeMissing
                fun _surcharge(): JsonField<Surcharge> = surcharge

                /**
                 * Returns the raw JSON value of [totalCumulative].
                 *
                 * Unlike [totalCumulative], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("total_cumulative")
                @ExcludeMissing
                fun _totalCumulative(): JsonField<TotalCumulative> = totalCumulative

                /**
                 * Returns the raw JSON value of [totalHealthcare].
                 *
                 * Unlike [totalHealthcare], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("total_healthcare")
                @ExcludeMissing
                fun _totalHealthcare(): JsonField<TotalHealthcare> = totalHealthcare

                /**
                 * Returns the raw JSON value of [transit].
                 *
                 * Unlike [transit], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("transit")
                @ExcludeMissing
                fun _transit(): JsonField<Transit> = transit

                /**
                 * Returns the raw JSON value of [unknown].
                 *
                 * Unlike [unknown], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("unknown")
                @ExcludeMissing
                fun _unknown(): JsonField<Unknown> = unknown

                /**
                 * Returns the raw JSON value of [vision].
                 *
                 * Unlike [vision], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("vision") @ExcludeMissing fun _vision(): JsonField<Vision> = vision

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of
                     * [AdditionalAmounts].
                     *
                     * The following fields are required:
                     * ```java
                     * .clinic()
                     * .dental()
                     * .original()
                     * .prescription()
                     * .surcharge()
                     * .totalCumulative()
                     * .totalHealthcare()
                     * .transit()
                     * .unknown()
                     * .vision()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [AdditionalAmounts]. */
                class Builder internal constructor() {

                    private var clinic: JsonField<Clinic>? = null
                    private var dental: JsonField<Dental>? = null
                    private var original: JsonField<Original>? = null
                    private var prescription: JsonField<Prescription>? = null
                    private var surcharge: JsonField<Surcharge>? = null
                    private var totalCumulative: JsonField<TotalCumulative>? = null
                    private var totalHealthcare: JsonField<TotalHealthcare>? = null
                    private var transit: JsonField<Transit>? = null
                    private var unknown: JsonField<Unknown>? = null
                    private var vision: JsonField<Vision>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(additionalAmounts: AdditionalAmounts) = apply {
                        clinic = additionalAmounts.clinic
                        dental = additionalAmounts.dental
                        original = additionalAmounts.original
                        prescription = additionalAmounts.prescription
                        surcharge = additionalAmounts.surcharge
                        totalCumulative = additionalAmounts.totalCumulative
                        totalHealthcare = additionalAmounts.totalHealthcare
                        transit = additionalAmounts.transit
                        unknown = additionalAmounts.unknown
                        vision = additionalAmounts.vision
                        additionalProperties = additionalAmounts.additionalProperties.toMutableMap()
                    }

                    /** The part of this transaction amount that was for clinic-related services. */
                    fun clinic(clinic: Clinic?) = clinic(JsonField.ofNullable(clinic))

                    /** Alias for calling [Builder.clinic] with `clinic.orElse(null)`. */
                    fun clinic(clinic: Optional<Clinic>) = clinic(clinic.getOrNull())

                    /**
                     * Sets [Builder.clinic] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.clinic] with a well-typed [Clinic] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun clinic(clinic: JsonField<Clinic>) = apply { this.clinic = clinic }

                    /** The part of this transaction amount that was for dental-related services. */
                    fun dental(dental: Dental?) = dental(JsonField.ofNullable(dental))

                    /** Alias for calling [Builder.dental] with `dental.orElse(null)`. */
                    fun dental(dental: Optional<Dental>) = dental(dental.getOrNull())

                    /**
                     * Sets [Builder.dental] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.dental] with a well-typed [Dental] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun dental(dental: JsonField<Dental>) = apply { this.dental = dental }

                    /** The original pre-authorized amount. */
                    fun original(original: Original?) = original(JsonField.ofNullable(original))

                    /** Alias for calling [Builder.original] with `original.orElse(null)`. */
                    fun original(original: Optional<Original>) = original(original.getOrNull())

                    /**
                     * Sets [Builder.original] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.original] with a well-typed [Original] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun original(original: JsonField<Original>) = apply { this.original = original }

                    /**
                     * The part of this transaction amount that was for healthcare prescriptions.
                     */
                    fun prescription(prescription: Prescription?) =
                        prescription(JsonField.ofNullable(prescription))

                    /**
                     * Alias for calling [Builder.prescription] with `prescription.orElse(null)`.
                     */
                    fun prescription(prescription: Optional<Prescription>) =
                        prescription(prescription.getOrNull())

                    /**
                     * Sets [Builder.prescription] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.prescription] with a well-typed
                     * [Prescription] value instead. This method is primarily for setting the field
                     * to an undocumented or not yet supported value.
                     */
                    fun prescription(prescription: JsonField<Prescription>) = apply {
                        this.prescription = prescription
                    }

                    /** The surcharge amount charged for this transaction by the merchant. */
                    fun surcharge(surcharge: Surcharge?) =
                        surcharge(JsonField.ofNullable(surcharge))

                    /** Alias for calling [Builder.surcharge] with `surcharge.orElse(null)`. */
                    fun surcharge(surcharge: Optional<Surcharge>) = surcharge(surcharge.getOrNull())

                    /**
                     * Sets [Builder.surcharge] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.surcharge] with a well-typed [Surcharge]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun surcharge(surcharge: JsonField<Surcharge>) = apply {
                        this.surcharge = surcharge
                    }

                    /**
                     * The total amount of a series of incremental authorizations, optionally
                     * provided.
                     */
                    fun totalCumulative(totalCumulative: TotalCumulative?) =
                        totalCumulative(JsonField.ofNullable(totalCumulative))

                    /**
                     * Alias for calling [Builder.totalCumulative] with
                     * `totalCumulative.orElse(null)`.
                     */
                    fun totalCumulative(totalCumulative: Optional<TotalCumulative>) =
                        totalCumulative(totalCumulative.getOrNull())

                    /**
                     * Sets [Builder.totalCumulative] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.totalCumulative] with a well-typed
                     * [TotalCumulative] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun totalCumulative(totalCumulative: JsonField<TotalCumulative>) = apply {
                        this.totalCumulative = totalCumulative
                    }

                    /** The total amount of healthcare-related additional amounts. */
                    fun totalHealthcare(totalHealthcare: TotalHealthcare?) =
                        totalHealthcare(JsonField.ofNullable(totalHealthcare))

                    /**
                     * Alias for calling [Builder.totalHealthcare] with
                     * `totalHealthcare.orElse(null)`.
                     */
                    fun totalHealthcare(totalHealthcare: Optional<TotalHealthcare>) =
                        totalHealthcare(totalHealthcare.getOrNull())

                    /**
                     * Sets [Builder.totalHealthcare] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.totalHealthcare] with a well-typed
                     * [TotalHealthcare] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun totalHealthcare(totalHealthcare: JsonField<TotalHealthcare>) = apply {
                        this.totalHealthcare = totalHealthcare
                    }

                    /**
                     * The part of this transaction amount that was for transit-related services.
                     */
                    fun transit(transit: Transit?) = transit(JsonField.ofNullable(transit))

                    /** Alias for calling [Builder.transit] with `transit.orElse(null)`. */
                    fun transit(transit: Optional<Transit>) = transit(transit.getOrNull())

                    /**
                     * Sets [Builder.transit] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.transit] with a well-typed [Transit] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun transit(transit: JsonField<Transit>) = apply { this.transit = transit }

                    /** An unknown additional amount. */
                    fun unknown(unknown: Unknown?) = unknown(JsonField.ofNullable(unknown))

                    /** Alias for calling [Builder.unknown] with `unknown.orElse(null)`. */
                    fun unknown(unknown: Optional<Unknown>) = unknown(unknown.getOrNull())

                    /**
                     * Sets [Builder.unknown] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.unknown] with a well-typed [Unknown] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun unknown(unknown: JsonField<Unknown>) = apply { this.unknown = unknown }

                    /** The part of this transaction amount that was for vision-related services. */
                    fun vision(vision: Vision?) = vision(JsonField.ofNullable(vision))

                    /** Alias for calling [Builder.vision] with `vision.orElse(null)`. */
                    fun vision(vision: Optional<Vision>) = vision(vision.getOrNull())

                    /**
                     * Sets [Builder.vision] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.vision] with a well-typed [Vision] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun vision(vision: JsonField<Vision>) = apply { this.vision = vision }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [AdditionalAmounts].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .clinic()
                     * .dental()
                     * .original()
                     * .prescription()
                     * .surcharge()
                     * .totalCumulative()
                     * .totalHealthcare()
                     * .transit()
                     * .unknown()
                     * .vision()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): AdditionalAmounts =
                        AdditionalAmounts(
                            checkRequired("clinic", clinic),
                            checkRequired("dental", dental),
                            checkRequired("original", original),
                            checkRequired("prescription", prescription),
                            checkRequired("surcharge", surcharge),
                            checkRequired("totalCumulative", totalCumulative),
                            checkRequired("totalHealthcare", totalHealthcare),
                            checkRequired("transit", transit),
                            checkRequired("unknown", unknown),
                            checkRequired("vision", vision),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): AdditionalAmounts = apply {
                    if (validated) {
                        return@apply
                    }

                    clinic().ifPresent { it.validate() }
                    dental().ifPresent { it.validate() }
                    original().ifPresent { it.validate() }
                    prescription().ifPresent { it.validate() }
                    surcharge().ifPresent { it.validate() }
                    totalCumulative().ifPresent { it.validate() }
                    totalHealthcare().ifPresent { it.validate() }
                    transit().ifPresent { it.validate() }
                    unknown().ifPresent { it.validate() }
                    vision().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (clinic.asKnown().getOrNull()?.validity() ?: 0) +
                        (dental.asKnown().getOrNull()?.validity() ?: 0) +
                        (original.asKnown().getOrNull()?.validity() ?: 0) +
                        (prescription.asKnown().getOrNull()?.validity() ?: 0) +
                        (surcharge.asKnown().getOrNull()?.validity() ?: 0) +
                        (totalCumulative.asKnown().getOrNull()?.validity() ?: 0) +
                        (totalHealthcare.asKnown().getOrNull()?.validity() ?: 0) +
                        (transit.asKnown().getOrNull()?.validity() ?: 0) +
                        (unknown.asKnown().getOrNull()?.validity() ?: 0) +
                        (vision.asKnown().getOrNull()?.validity() ?: 0)

                /** The part of this transaction amount that was for clinic-related services. */
                class Clinic
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Clinic].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Clinic]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(clinic: Clinic) = apply {
                            amount = clinic.amount
                            currency = clinic.currency
                            additionalProperties = clinic.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Clinic].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Clinic =
                            Clinic(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Clinic = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Clinic &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Clinic{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for dental-related services. */
                class Dental
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Dental].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Dental]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(dental: Dental) = apply {
                            amount = dental.amount
                            currency = dental.currency
                            additionalProperties = dental.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Dental].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Dental =
                            Dental(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Dental = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Dental &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Dental{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The original pre-authorized amount. */
                class Original
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Original].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Original]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(original: Original) = apply {
                            amount = original.amount
                            currency = original.currency
                            additionalProperties = original.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Original].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Original =
                            Original(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Original = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Original &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Original{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for healthcare prescriptions. */
                class Prescription
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Prescription].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Prescription]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(prescription: Prescription) = apply {
                            amount = prescription.amount
                            currency = prescription.currency
                            additionalProperties = prescription.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Prescription].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Prescription =
                            Prescription(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Prescription = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Prescription &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Prescription{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The surcharge amount charged for this transaction by the merchant. */
                class Surcharge
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Surcharge].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Surcharge]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(surcharge: Surcharge) = apply {
                            amount = surcharge.amount
                            currency = surcharge.currency
                            additionalProperties = surcharge.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Surcharge].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Surcharge =
                            Surcharge(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Surcharge = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Surcharge &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Surcharge{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /**
                 * The total amount of a series of incremental authorizations, optionally provided.
                 */
                class TotalCumulative
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [TotalCumulative].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [TotalCumulative]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(totalCumulative: TotalCumulative) = apply {
                            amount = totalCumulative.amount
                            currency = totalCumulative.currency
                            additionalProperties =
                                totalCumulative.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [TotalCumulative].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): TotalCumulative =
                            TotalCumulative(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): TotalCumulative = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is TotalCumulative &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "TotalCumulative{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The total amount of healthcare-related additional amounts. */
                class TotalHealthcare
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [TotalHealthcare].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [TotalHealthcare]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(totalHealthcare: TotalHealthcare) = apply {
                            amount = totalHealthcare.amount
                            currency = totalHealthcare.currency
                            additionalProperties =
                                totalHealthcare.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [TotalHealthcare].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): TotalHealthcare =
                            TotalHealthcare(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): TotalHealthcare = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is TotalHealthcare &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "TotalHealthcare{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for transit-related services. */
                class Transit
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Transit].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Transit]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(transit: Transit) = apply {
                            amount = transit.amount
                            currency = transit.currency
                            additionalProperties = transit.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Transit].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Transit =
                            Transit(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Transit = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Transit &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Transit{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** An unknown additional amount. */
                class Unknown
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Unknown].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Unknown]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(unknown: Unknown) = apply {
                            amount = unknown.amount
                            currency = unknown.currency
                            additionalProperties = unknown.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Unknown].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Unknown =
                            Unknown(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Unknown = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Unknown &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Unknown{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for vision-related services. */
                class Vision
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Vision].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Vision]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(vision: Vision) = apply {
                            amount = vision.amount
                            currency = vision.currency
                            additionalProperties = vision.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Vision].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Vision =
                            Vision(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Vision = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Vision &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Vision{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is AdditionalAmounts &&
                        clinic == other.clinic &&
                        dental == other.dental &&
                        original == other.original &&
                        prescription == other.prescription &&
                        surcharge == other.surcharge &&
                        totalCumulative == other.totalCumulative &&
                        totalHealthcare == other.totalHealthcare &&
                        transit == other.transit &&
                        unknown == other.unknown &&
                        vision == other.vision &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        clinic,
                        dental,
                        original,
                        prescription,
                        surcharge,
                        totalCumulative,
                        totalHealthcare,
                        transit,
                        unknown,
                        vision,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "AdditionalAmounts{clinic=$clinic, dental=$dental, original=$original, prescription=$prescription, surcharge=$surcharge, totalCumulative=$totalCumulative, totalHealthcare=$totalHealthcare, transit=$transit, unknown=$unknown, vision=$vision, additionalProperties=$additionalProperties}"
            }

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
             * currency.
             */
            class Currency @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** US Dollar (USD) */
                    @JvmField val USD = of("USD")

                    @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                }

                /** An enum containing [Currency]'s known values. */
                enum class Known {
                    /** US Dollar (USD) */
                    USD
                }

                /**
                 * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Currency] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** US Dollar (USD) */
                    USD,
                    /**
                     * An enum member indicating that [Currency] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        USD -> Value.USD
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        USD -> Known.USD
                        else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Currency = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Currency && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /**
             * The direction describes the direction the funds will move, either from the cardholder
             * to the merchant or from the merchant to the cardholder.
             */
            class Direction @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** A regular card authorization where funds are debited from the cardholder. */
                    @JvmField val SETTLEMENT = of("settlement")

                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    @JvmField val REFUND = of("refund")

                    @JvmStatic fun of(value: String) = Direction(JsonField.of(value))
                }

                /** An enum containing [Direction]'s known values. */
                enum class Known {
                    /** A regular card authorization where funds are debited from the cardholder. */
                    SETTLEMENT,
                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    REFUND,
                }

                /**
                 * An enum containing [Direction]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Direction] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** A regular card authorization where funds are debited from the cardholder. */
                    SETTLEMENT,
                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    REFUND,
                    /**
                     * An enum member indicating that [Direction] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        SETTLEMENT -> Value.SETTLEMENT
                        REFUND -> Value.REFUND
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        SETTLEMENT -> Known.SETTLEMENT
                        REFUND -> Known.REFUND
                        else -> throw IncreaseInvalidDataException("Unknown Direction: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Direction = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Direction && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /**
             * The healthcare-related fields for this authorization. Only present for specific
             * programs.
             */
            class Healthcare
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val merchantNinetyPercentEligibility:
                    JsonField<MerchantNinetyPercentEligibility>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("merchant_ninety_percent_eligibility")
                    @ExcludeMissing
                    merchantNinetyPercentEligibility: JsonField<MerchantNinetyPercentEligibility> =
                        JsonMissing.of()
                ) : this(merchantNinetyPercentEligibility, mutableMapOf())

                /**
                 * The merchant's eligibility under the Internal Revenue Service's 90% Rule for
                 * Flexible Spending Account (FSA) and Health Savings Account (HSA) eligible
                 * products. The eligibility is determined based on the list of merchants maintained
                 * by the Special Interest Group for IIAS Standards (SIGIS).
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun merchantNinetyPercentEligibility(): MerchantNinetyPercentEligibility =
                    merchantNinetyPercentEligibility.getRequired(
                        "merchant_ninety_percent_eligibility"
                    )

                /**
                 * Returns the raw JSON value of [merchantNinetyPercentEligibility].
                 *
                 * Unlike [merchantNinetyPercentEligibility], this method doesn't throw if the JSON
                 * field has an unexpected type.
                 */
                @JsonProperty("merchant_ninety_percent_eligibility")
                @ExcludeMissing
                fun _merchantNinetyPercentEligibility():
                    JsonField<MerchantNinetyPercentEligibility> = merchantNinetyPercentEligibility

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [Healthcare].
                     *
                     * The following fields are required:
                     * ```java
                     * .merchantNinetyPercentEligibility()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [Healthcare]. */
                class Builder internal constructor() {

                    private var merchantNinetyPercentEligibility:
                        JsonField<MerchantNinetyPercentEligibility>? =
                        null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(healthcare: Healthcare) = apply {
                        merchantNinetyPercentEligibility =
                            healthcare.merchantNinetyPercentEligibility
                        additionalProperties = healthcare.additionalProperties.toMutableMap()
                    }

                    /**
                     * The merchant's eligibility under the Internal Revenue Service's 90% Rule for
                     * Flexible Spending Account (FSA) and Health Savings Account (HSA) eligible
                     * products. The eligibility is determined based on the list of merchants
                     * maintained by the Special Interest Group for IIAS Standards (SIGIS).
                     */
                    fun merchantNinetyPercentEligibility(
                        merchantNinetyPercentEligibility: MerchantNinetyPercentEligibility
                    ) =
                        merchantNinetyPercentEligibility(
                            JsonField.of(merchantNinetyPercentEligibility)
                        )

                    /**
                     * Sets [Builder.merchantNinetyPercentEligibility] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.merchantNinetyPercentEligibility] with a
                     * well-typed [MerchantNinetyPercentEligibility] value instead. This method is
                     * primarily for setting the field to an undocumented or not yet supported
                     * value.
                     */
                    fun merchantNinetyPercentEligibility(
                        merchantNinetyPercentEligibility:
                            JsonField<MerchantNinetyPercentEligibility>
                    ) = apply {
                        this.merchantNinetyPercentEligibility = merchantNinetyPercentEligibility
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [Healthcare].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .merchantNinetyPercentEligibility()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): Healthcare =
                        Healthcare(
                            checkRequired(
                                "merchantNinetyPercentEligibility",
                                merchantNinetyPercentEligibility,
                            ),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Healthcare = apply {
                    if (validated) {
                        return@apply
                    }

                    merchantNinetyPercentEligibility().validate()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (merchantNinetyPercentEligibility.asKnown().getOrNull()?.validity() ?: 0)

                /**
                 * The merchant's eligibility under the Internal Revenue Service's 90% Rule for
                 * Flexible Spending Account (FSA) and Health Savings Account (HSA) eligible
                 * products. The eligibility is determined based on the list of merchants maintained
                 * by the Special Interest Group for IIAS Standards (SIGIS).
                 */
                class MerchantNinetyPercentEligibility
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** The merchant is eligible for treatment under the 90% rule. */
                        @JvmField val ELIGIBLE = of("eligible")

                        /** The merchant is not eligible for treatment under the 90% rule. */
                        @JvmField val NOT_ELIGIBLE = of("not_eligible")

                        @JvmStatic
                        fun of(value: String) =
                            MerchantNinetyPercentEligibility(JsonField.of(value))
                    }

                    /** An enum containing [MerchantNinetyPercentEligibility]'s known values. */
                    enum class Known {
                        /** The merchant is eligible for treatment under the 90% rule. */
                        ELIGIBLE,
                        /** The merchant is not eligible for treatment under the 90% rule. */
                        NOT_ELIGIBLE,
                    }

                    /**
                     * An enum containing [MerchantNinetyPercentEligibility]'s known values, as well
                     * as an [_UNKNOWN] member.
                     *
                     * An instance of [MerchantNinetyPercentEligibility] can contain an unknown
                     * value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** The merchant is eligible for treatment under the 90% rule. */
                        ELIGIBLE,
                        /** The merchant is not eligible for treatment under the 90% rule. */
                        NOT_ELIGIBLE,
                        /**
                         * An enum member indicating that [MerchantNinetyPercentEligibility] was
                         * instantiated with an unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            ELIGIBLE -> Value.ELIGIBLE
                            NOT_ELIGIBLE -> Value.NOT_ELIGIBLE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            ELIGIBLE -> Known.ELIGIBLE
                            NOT_ELIGIBLE -> Known.NOT_ELIGIBLE
                            else ->
                                throw IncreaseInvalidDataException(
                                    "Unknown MerchantNinetyPercentEligibility: $value"
                                )
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): MerchantNinetyPercentEligibility = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is MerchantNinetyPercentEligibility && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Healthcare &&
                        merchantNinetyPercentEligibility ==
                            other.merchantNinetyPercentEligibility &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(merchantNinetyPercentEligibility, additionalProperties)
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "Healthcare{merchantNinetyPercentEligibility=$merchantNinetyPercentEligibility, additionalProperties=$additionalProperties}"
            }

            /** Fields specific to the `network`. */
            class NetworkDetails
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val category: JsonField<Category>,
                private val pulse: JsonField<Pulse>,
                private val visa: JsonField<Visa>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("category")
                    @ExcludeMissing
                    category: JsonField<Category> = JsonMissing.of(),
                    @JsonProperty("pulse")
                    @ExcludeMissing
                    pulse: JsonField<Pulse> = JsonMissing.of(),
                    @JsonProperty("visa") @ExcludeMissing visa: JsonField<Visa> = JsonMissing.of(),
                ) : this(category, pulse, visa, mutableMapOf())

                /**
                 * The payment network used to process this card authorization.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun category(): Category = category.getRequired("category")

                /**
                 * Fields specific to the `pulse` network.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun pulse(): Optional<Pulse> = pulse.getOptional("pulse")

                /**
                 * Fields specific to the `visa` network.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun visa(): Optional<Visa> = visa.getOptional("visa")

                /**
                 * Returns the raw JSON value of [category].
                 *
                 * Unlike [category], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("category")
                @ExcludeMissing
                fun _category(): JsonField<Category> = category

                /**
                 * Returns the raw JSON value of [pulse].
                 *
                 * Unlike [pulse], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("pulse") @ExcludeMissing fun _pulse(): JsonField<Pulse> = pulse

                /**
                 * Returns the raw JSON value of [visa].
                 *
                 * Unlike [visa], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("visa") @ExcludeMissing fun _visa(): JsonField<Visa> = visa

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [NetworkDetails].
                     *
                     * The following fields are required:
                     * ```java
                     * .category()
                     * .pulse()
                     * .visa()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [NetworkDetails]. */
                class Builder internal constructor() {

                    private var category: JsonField<Category>? = null
                    private var pulse: JsonField<Pulse>? = null
                    private var visa: JsonField<Visa>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(networkDetails: NetworkDetails) = apply {
                        category = networkDetails.category
                        pulse = networkDetails.pulse
                        visa = networkDetails.visa
                        additionalProperties = networkDetails.additionalProperties.toMutableMap()
                    }

                    /** The payment network used to process this card authorization. */
                    fun category(category: Category) = category(JsonField.of(category))

                    /**
                     * Sets [Builder.category] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.category] with a well-typed [Category] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun category(category: JsonField<Category>) = apply { this.category = category }

                    /** Fields specific to the `pulse` network. */
                    fun pulse(pulse: Pulse?) = pulse(JsonField.ofNullable(pulse))

                    /** Alias for calling [Builder.pulse] with `pulse.orElse(null)`. */
                    fun pulse(pulse: Optional<Pulse>) = pulse(pulse.getOrNull())

                    /**
                     * Sets [Builder.pulse] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.pulse] with a well-typed [Pulse] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun pulse(pulse: JsonField<Pulse>) = apply { this.pulse = pulse }

                    /** Fields specific to the `visa` network. */
                    fun visa(visa: Visa?) = visa(JsonField.ofNullable(visa))

                    /** Alias for calling [Builder.visa] with `visa.orElse(null)`. */
                    fun visa(visa: Optional<Visa>) = visa(visa.getOrNull())

                    /**
                     * Sets [Builder.visa] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.visa] with a well-typed [Visa] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun visa(visa: JsonField<Visa>) = apply { this.visa = visa }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [NetworkDetails].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .category()
                     * .pulse()
                     * .visa()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): NetworkDetails =
                        NetworkDetails(
                            checkRequired("category", category),
                            checkRequired("pulse", pulse),
                            checkRequired("visa", visa),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): NetworkDetails = apply {
                    if (validated) {
                        return@apply
                    }

                    category().validate()
                    pulse().ifPresent { it.validate() }
                    visa().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (category.asKnown().getOrNull()?.validity() ?: 0) +
                        (pulse.asKnown().getOrNull()?.validity() ?: 0) +
                        (visa.asKnown().getOrNull()?.validity() ?: 0)

                /** The payment network used to process this card authorization. */
                class Category
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** Visa */
                        @JvmField val VISA = of("visa")

                        /** Pulse */
                        @JvmField val PULSE = of("pulse")

                        @JvmStatic fun of(value: String) = Category(JsonField.of(value))
                    }

                    /** An enum containing [Category]'s known values. */
                    enum class Known {
                        /** Visa */
                        VISA,
                        /** Pulse */
                        PULSE,
                    }

                    /**
                     * An enum containing [Category]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Category] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** Visa */
                        VISA,
                        /** Pulse */
                        PULSE,
                        /**
                         * An enum member indicating that [Category] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            VISA -> Value.VISA
                            PULSE -> Value.PULSE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            VISA -> Known.VISA
                            PULSE -> Known.PULSE
                            else -> throw IncreaseInvalidDataException("Unknown Category: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Category = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Category && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** Fields specific to the `pulse` network. */
                class Pulse
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val additionalProperties: MutableMap<String, JsonValue>
                ) {

                    @JsonCreator private constructor() : this(mutableMapOf())

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /** Returns a mutable builder for constructing an instance of [Pulse]. */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Pulse]. */
                    class Builder internal constructor() {

                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(pulse: Pulse) = apply {
                            additionalProperties = pulse.additionalProperties.toMutableMap()
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Pulse].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         */
                        fun build(): Pulse = Pulse(additionalProperties.toMutableMap())
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Pulse = apply {
                        if (validated) {
                            return@apply
                        }

                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic internal fun validity(): Int = 0

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Pulse && additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy { Objects.hash(additionalProperties) }

                    override fun hashCode(): Int = hashCode

                    override fun toString() = "Pulse{additionalProperties=$additionalProperties}"
                }

                /** Fields specific to the `visa` network. */
                class Visa
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val electronicCommerceIndicator: JsonField<ElectronicCommerceIndicator>,
                    private val pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode>,
                    private val standInProcessingReason: JsonField<StandInProcessingReason>,
                    private val terminalEntryCapability: JsonField<TerminalEntryCapability>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("electronic_commerce_indicator")
                        @ExcludeMissing
                        electronicCommerceIndicator: JsonField<ElectronicCommerceIndicator> =
                            JsonMissing.of(),
                        @JsonProperty("point_of_service_entry_mode")
                        @ExcludeMissing
                        pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode> =
                            JsonMissing.of(),
                        @JsonProperty("stand_in_processing_reason")
                        @ExcludeMissing
                        standInProcessingReason: JsonField<StandInProcessingReason> =
                            JsonMissing.of(),
                        @JsonProperty("terminal_entry_capability")
                        @ExcludeMissing
                        terminalEntryCapability: JsonField<TerminalEntryCapability> =
                            JsonMissing.of(),
                    ) : this(
                        electronicCommerceIndicator,
                        pointOfServiceEntryMode,
                        standInProcessingReason,
                        terminalEntryCapability,
                        mutableMapOf(),
                    )

                    /**
                     * For electronic commerce transactions, this identifies the level of security
                     * used in obtaining the customer's payment credential. For mail or telephone
                     * order transactions, identifies the type of mail or telephone order.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun electronicCommerceIndicator(): Optional<ElectronicCommerceIndicator> =
                        electronicCommerceIndicator.getOptional("electronic_commerce_indicator")

                    /**
                     * The method used to enter the cardholder's primary account number and card
                     * expiration date.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun pointOfServiceEntryMode(): Optional<PointOfServiceEntryMode> =
                        pointOfServiceEntryMode.getOptional("point_of_service_entry_mode")

                    /**
                     * Only present when `actioner: network`. Describes why a card authorization was
                     * approved or declined by Visa through stand-in processing.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun standInProcessingReason(): Optional<StandInProcessingReason> =
                        standInProcessingReason.getOptional("stand_in_processing_reason")

                    /**
                     * The capability of the terminal being used to read the card. Shows whether a
                     * terminal can e.g., accept chip cards or if it only supports magnetic stripe
                     * reads. This reflects the highest capability of the terminal — for example, a
                     * terminal that supports both chip and magnetic stripe will be identified as
                     * chip-capable.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun terminalEntryCapability(): Optional<TerminalEntryCapability> =
                        terminalEntryCapability.getOptional("terminal_entry_capability")

                    /**
                     * Returns the raw JSON value of [electronicCommerceIndicator].
                     *
                     * Unlike [electronicCommerceIndicator], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("electronic_commerce_indicator")
                    @ExcludeMissing
                    fun _electronicCommerceIndicator(): JsonField<ElectronicCommerceIndicator> =
                        electronicCommerceIndicator

                    /**
                     * Returns the raw JSON value of [pointOfServiceEntryMode].
                     *
                     * Unlike [pointOfServiceEntryMode], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("point_of_service_entry_mode")
                    @ExcludeMissing
                    fun _pointOfServiceEntryMode(): JsonField<PointOfServiceEntryMode> =
                        pointOfServiceEntryMode

                    /**
                     * Returns the raw JSON value of [standInProcessingReason].
                     *
                     * Unlike [standInProcessingReason], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("stand_in_processing_reason")
                    @ExcludeMissing
                    fun _standInProcessingReason(): JsonField<StandInProcessingReason> =
                        standInProcessingReason

                    /**
                     * Returns the raw JSON value of [terminalEntryCapability].
                     *
                     * Unlike [terminalEntryCapability], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("terminal_entry_capability")
                    @ExcludeMissing
                    fun _terminalEntryCapability(): JsonField<TerminalEntryCapability> =
                        terminalEntryCapability

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Visa].
                         *
                         * The following fields are required:
                         * ```java
                         * .electronicCommerceIndicator()
                         * .pointOfServiceEntryMode()
                         * .standInProcessingReason()
                         * .terminalEntryCapability()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Visa]. */
                    class Builder internal constructor() {

                        private var electronicCommerceIndicator:
                            JsonField<ElectronicCommerceIndicator>? =
                            null
                        private var pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode>? =
                            null
                        private var standInProcessingReason: JsonField<StandInProcessingReason>? =
                            null
                        private var terminalEntryCapability: JsonField<TerminalEntryCapability>? =
                            null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(visa: Visa) = apply {
                            electronicCommerceIndicator = visa.electronicCommerceIndicator
                            pointOfServiceEntryMode = visa.pointOfServiceEntryMode
                            standInProcessingReason = visa.standInProcessingReason
                            terminalEntryCapability = visa.terminalEntryCapability
                            additionalProperties = visa.additionalProperties.toMutableMap()
                        }

                        /**
                         * For electronic commerce transactions, this identifies the level of
                         * security used in obtaining the customer's payment credential. For mail or
                         * telephone order transactions, identifies the type of mail or telephone
                         * order.
                         */
                        fun electronicCommerceIndicator(
                            electronicCommerceIndicator: ElectronicCommerceIndicator?
                        ) =
                            electronicCommerceIndicator(
                                JsonField.ofNullable(electronicCommerceIndicator)
                            )

                        /**
                         * Alias for calling [Builder.electronicCommerceIndicator] with
                         * `electronicCommerceIndicator.orElse(null)`.
                         */
                        fun electronicCommerceIndicator(
                            electronicCommerceIndicator: Optional<ElectronicCommerceIndicator>
                        ) = electronicCommerceIndicator(electronicCommerceIndicator.getOrNull())

                        /**
                         * Sets [Builder.electronicCommerceIndicator] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.electronicCommerceIndicator] with a
                         * well-typed [ElectronicCommerceIndicator] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun electronicCommerceIndicator(
                            electronicCommerceIndicator: JsonField<ElectronicCommerceIndicator>
                        ) = apply { this.electronicCommerceIndicator = electronicCommerceIndicator }

                        /**
                         * The method used to enter the cardholder's primary account number and card
                         * expiration date.
                         */
                        fun pointOfServiceEntryMode(
                            pointOfServiceEntryMode: PointOfServiceEntryMode?
                        ) = pointOfServiceEntryMode(JsonField.ofNullable(pointOfServiceEntryMode))

                        /**
                         * Alias for calling [Builder.pointOfServiceEntryMode] with
                         * `pointOfServiceEntryMode.orElse(null)`.
                         */
                        fun pointOfServiceEntryMode(
                            pointOfServiceEntryMode: Optional<PointOfServiceEntryMode>
                        ) = pointOfServiceEntryMode(pointOfServiceEntryMode.getOrNull())

                        /**
                         * Sets [Builder.pointOfServiceEntryMode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.pointOfServiceEntryMode] with a
                         * well-typed [PointOfServiceEntryMode] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun pointOfServiceEntryMode(
                            pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode>
                        ) = apply { this.pointOfServiceEntryMode = pointOfServiceEntryMode }

                        /**
                         * Only present when `actioner: network`. Describes why a card authorization
                         * was approved or declined by Visa through stand-in processing.
                         */
                        fun standInProcessingReason(
                            standInProcessingReason: StandInProcessingReason?
                        ) = standInProcessingReason(JsonField.ofNullable(standInProcessingReason))

                        /**
                         * Alias for calling [Builder.standInProcessingReason] with
                         * `standInProcessingReason.orElse(null)`.
                         */
                        fun standInProcessingReason(
                            standInProcessingReason: Optional<StandInProcessingReason>
                        ) = standInProcessingReason(standInProcessingReason.getOrNull())

                        /**
                         * Sets [Builder.standInProcessingReason] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.standInProcessingReason] with a
                         * well-typed [StandInProcessingReason] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun standInProcessingReason(
                            standInProcessingReason: JsonField<StandInProcessingReason>
                        ) = apply { this.standInProcessingReason = standInProcessingReason }

                        /**
                         * The capability of the terminal being used to read the card. Shows whether
                         * a terminal can e.g., accept chip cards or if it only supports magnetic
                         * stripe reads. This reflects the highest capability of the terminal — for
                         * example, a terminal that supports both chip and magnetic stripe will be
                         * identified as chip-capable.
                         */
                        fun terminalEntryCapability(
                            terminalEntryCapability: TerminalEntryCapability?
                        ) = terminalEntryCapability(JsonField.ofNullable(terminalEntryCapability))

                        /**
                         * Alias for calling [Builder.terminalEntryCapability] with
                         * `terminalEntryCapability.orElse(null)`.
                         */
                        fun terminalEntryCapability(
                            terminalEntryCapability: Optional<TerminalEntryCapability>
                        ) = terminalEntryCapability(terminalEntryCapability.getOrNull())

                        /**
                         * Sets [Builder.terminalEntryCapability] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.terminalEntryCapability] with a
                         * well-typed [TerminalEntryCapability] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun terminalEntryCapability(
                            terminalEntryCapability: JsonField<TerminalEntryCapability>
                        ) = apply { this.terminalEntryCapability = terminalEntryCapability }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Visa].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .electronicCommerceIndicator()
                         * .pointOfServiceEntryMode()
                         * .standInProcessingReason()
                         * .terminalEntryCapability()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Visa =
                            Visa(
                                checkRequired(
                                    "electronicCommerceIndicator",
                                    electronicCommerceIndicator,
                                ),
                                checkRequired("pointOfServiceEntryMode", pointOfServiceEntryMode),
                                checkRequired("standInProcessingReason", standInProcessingReason),
                                checkRequired("terminalEntryCapability", terminalEntryCapability),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Visa = apply {
                        if (validated) {
                            return@apply
                        }

                        electronicCommerceIndicator().ifPresent { it.validate() }
                        pointOfServiceEntryMode().ifPresent { it.validate() }
                        standInProcessingReason().ifPresent { it.validate() }
                        terminalEntryCapability().ifPresent { it.validate() }
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (electronicCommerceIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                            (pointOfServiceEntryMode.asKnown().getOrNull()?.validity() ?: 0) +
                            (standInProcessingReason.asKnown().getOrNull()?.validity() ?: 0) +
                            (terminalEntryCapability.asKnown().getOrNull()?.validity() ?: 0)

                    /**
                     * For electronic commerce transactions, this identifies the level of security
                     * used in obtaining the customer's payment credential. For mail or telephone
                     * order transactions, identifies the type of mail or telephone order.
                     */
                    class ElectronicCommerceIndicator
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /**
                             * Single transaction of a mail/phone order: Use to indicate that the
                             * transaction is a mail/phone order purchase, not a recurring
                             * transaction or installment payment. For domestic transactions in the
                             * US region, this value may also indicate one bill payment transaction
                             * in the card-present or card-absent environments.
                             */
                            @JvmField val MAIL_PHONE_ORDER = of("mail_phone_order")

                            /**
                             * Recurring transaction: Payment indicator used to indicate a recurring
                             * transaction that originates from an acquirer in the US region.
                             */
                            @JvmField val RECURRING = of("recurring")

                            /**
                             * Installment payment: Payment indicator used to indicate one purchase
                             * of goods or services that is billed to the account in multiple
                             * charges over a period of time agreed upon by the cardholder and
                             * merchant from transactions that originate from an acquirer in the US
                             * region.
                             */
                            @JvmField val INSTALLMENT = of("installment")

                            /**
                             * Unknown classification: other mail order: Use to indicate that the
                             * type of mail/telephone order is unknown.
                             */
                            @JvmField val UNKNOWN_MAIL_PHONE_ORDER = of("unknown_mail_phone_order")

                            /**
                             * Secure electronic commerce transaction: Use to indicate that the
                             * electronic commerce transaction has been authenticated using e.g.,
                             * 3-D Secure
                             */
                            @JvmField
                            val SECURE_ELECTRONIC_COMMERCE = of("secure_electronic_commerce")

                            /**
                             * Non-authenticated security transaction at a 3-D Secure-capable
                             * merchant, and merchant attempted to authenticate the cardholder using
                             * 3-D Secure: Use to identify an electronic commerce transaction where
                             * the merchant attempted to authenticate the cardholder using 3-D
                             * Secure, but was unable to complete the authentication because the
                             * issuer or cardholder does not participate in the 3-D Secure program.
                             */
                            @JvmField
                            val NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT =
                                of("non_authenticated_security_transaction_at_3ds_capable_merchant")

                            /**
                             * Non-authenticated security transaction: Use to identify an electronic
                             * commerce transaction that uses data encryption for security however,
                             * cardholder authentication is not performed using 3-D Secure.
                             */
                            @JvmField
                            val NON_AUTHENTICATED_SECURITY_TRANSACTION =
                                of("non_authenticated_security_transaction")

                            /**
                             * Non-secure transaction: Use to identify an electronic commerce
                             * transaction that has no data protection.
                             */
                            @JvmField val NON_SECURE_TRANSACTION = of("non_secure_transaction")

                            @JvmStatic
                            fun of(value: String) = ElectronicCommerceIndicator(JsonField.of(value))
                        }

                        /** An enum containing [ElectronicCommerceIndicator]'s known values. */
                        enum class Known {
                            /**
                             * Single transaction of a mail/phone order: Use to indicate that the
                             * transaction is a mail/phone order purchase, not a recurring
                             * transaction or installment payment. For domestic transactions in the
                             * US region, this value may also indicate one bill payment transaction
                             * in the card-present or card-absent environments.
                             */
                            MAIL_PHONE_ORDER,
                            /**
                             * Recurring transaction: Payment indicator used to indicate a recurring
                             * transaction that originates from an acquirer in the US region.
                             */
                            RECURRING,
                            /**
                             * Installment payment: Payment indicator used to indicate one purchase
                             * of goods or services that is billed to the account in multiple
                             * charges over a period of time agreed upon by the cardholder and
                             * merchant from transactions that originate from an acquirer in the US
                             * region.
                             */
                            INSTALLMENT,
                            /**
                             * Unknown classification: other mail order: Use to indicate that the
                             * type of mail/telephone order is unknown.
                             */
                            UNKNOWN_MAIL_PHONE_ORDER,
                            /**
                             * Secure electronic commerce transaction: Use to indicate that the
                             * electronic commerce transaction has been authenticated using e.g.,
                             * 3-D Secure
                             */
                            SECURE_ELECTRONIC_COMMERCE,
                            /**
                             * Non-authenticated security transaction at a 3-D Secure-capable
                             * merchant, and merchant attempted to authenticate the cardholder using
                             * 3-D Secure: Use to identify an electronic commerce transaction where
                             * the merchant attempted to authenticate the cardholder using 3-D
                             * Secure, but was unable to complete the authentication because the
                             * issuer or cardholder does not participate in the 3-D Secure program.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT,
                            /**
                             * Non-authenticated security transaction: Use to identify an electronic
                             * commerce transaction that uses data encryption for security however,
                             * cardholder authentication is not performed using 3-D Secure.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION,
                            /**
                             * Non-secure transaction: Use to identify an electronic commerce
                             * transaction that has no data protection.
                             */
                            NON_SECURE_TRANSACTION,
                        }

                        /**
                         * An enum containing [ElectronicCommerceIndicator]'s known values, as well
                         * as an [_UNKNOWN] member.
                         *
                         * An instance of [ElectronicCommerceIndicator] can contain an unknown value
                         * in a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /**
                             * Single transaction of a mail/phone order: Use to indicate that the
                             * transaction is a mail/phone order purchase, not a recurring
                             * transaction or installment payment. For domestic transactions in the
                             * US region, this value may also indicate one bill payment transaction
                             * in the card-present or card-absent environments.
                             */
                            MAIL_PHONE_ORDER,
                            /**
                             * Recurring transaction: Payment indicator used to indicate a recurring
                             * transaction that originates from an acquirer in the US region.
                             */
                            RECURRING,
                            /**
                             * Installment payment: Payment indicator used to indicate one purchase
                             * of goods or services that is billed to the account in multiple
                             * charges over a period of time agreed upon by the cardholder and
                             * merchant from transactions that originate from an acquirer in the US
                             * region.
                             */
                            INSTALLMENT,
                            /**
                             * Unknown classification: other mail order: Use to indicate that the
                             * type of mail/telephone order is unknown.
                             */
                            UNKNOWN_MAIL_PHONE_ORDER,
                            /**
                             * Secure electronic commerce transaction: Use to indicate that the
                             * electronic commerce transaction has been authenticated using e.g.,
                             * 3-D Secure
                             */
                            SECURE_ELECTRONIC_COMMERCE,
                            /**
                             * Non-authenticated security transaction at a 3-D Secure-capable
                             * merchant, and merchant attempted to authenticate the cardholder using
                             * 3-D Secure: Use to identify an electronic commerce transaction where
                             * the merchant attempted to authenticate the cardholder using 3-D
                             * Secure, but was unable to complete the authentication because the
                             * issuer or cardholder does not participate in the 3-D Secure program.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT,
                            /**
                             * Non-authenticated security transaction: Use to identify an electronic
                             * commerce transaction that uses data encryption for security however,
                             * cardholder authentication is not performed using 3-D Secure.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION,
                            /**
                             * Non-secure transaction: Use to identify an electronic commerce
                             * transaction that has no data protection.
                             */
                            NON_SECURE_TRANSACTION,
                            /**
                             * An enum member indicating that [ElectronicCommerceIndicator] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                MAIL_PHONE_ORDER -> Value.MAIL_PHONE_ORDER
                                RECURRING -> Value.RECURRING
                                INSTALLMENT -> Value.INSTALLMENT
                                UNKNOWN_MAIL_PHONE_ORDER -> Value.UNKNOWN_MAIL_PHONE_ORDER
                                SECURE_ELECTRONIC_COMMERCE -> Value.SECURE_ELECTRONIC_COMMERCE
                                NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT ->
                                    Value
                                        .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT
                                NON_AUTHENTICATED_SECURITY_TRANSACTION ->
                                    Value.NON_AUTHENTICATED_SECURITY_TRANSACTION
                                NON_SECURE_TRANSACTION -> Value.NON_SECURE_TRANSACTION
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                MAIL_PHONE_ORDER -> Known.MAIL_PHONE_ORDER
                                RECURRING -> Known.RECURRING
                                INSTALLMENT -> Known.INSTALLMENT
                                UNKNOWN_MAIL_PHONE_ORDER -> Known.UNKNOWN_MAIL_PHONE_ORDER
                                SECURE_ELECTRONIC_COMMERCE -> Known.SECURE_ELECTRONIC_COMMERCE
                                NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT ->
                                    Known
                                        .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT
                                NON_AUTHENTICATED_SECURITY_TRANSACTION ->
                                    Known.NON_AUTHENTICATED_SECURITY_TRANSACTION
                                NON_SECURE_TRANSACTION -> Known.NON_SECURE_TRANSACTION
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown ElectronicCommerceIndicator: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): ElectronicCommerceIndicator = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is ElectronicCommerceIndicator && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * The method used to enter the cardholder's primary account number and card
                     * expiration date.
                     */
                    class PointOfServiceEntryMode
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Unknown */
                            @JvmField val UNKNOWN = of("unknown")

                            /** Manual key entry */
                            @JvmField val MANUAL = of("manual")

                            /** Magnetic stripe read, without card verification value */
                            @JvmField val MAGNETIC_STRIPE_NO_CVV = of("magnetic_stripe_no_cvv")

                            /** Optical code */
                            @JvmField val OPTICAL_CODE = of("optical_code")

                            /** Contact chip card */
                            @JvmField val INTEGRATED_CIRCUIT_CARD = of("integrated_circuit_card")

                            /** Contactless read of chip card */
                            @JvmField val CONTACTLESS = of("contactless")

                            /**
                             * Transaction initiated using a credential that has previously been
                             * stored on file
                             */
                            @JvmField val CREDENTIAL_ON_FILE = of("credential_on_file")

                            /** Magnetic stripe read */
                            @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe")

                            /** Contactless read of magnetic stripe data */
                            @JvmField
                            val CONTACTLESS_MAGNETIC_STRIPE = of("contactless_magnetic_stripe")

                            /** Contact chip card, without card verification value */
                            @JvmField
                            val INTEGRATED_CIRCUIT_CARD_NO_CVV =
                                of("integrated_circuit_card_no_cvv")

                            @JvmStatic
                            fun of(value: String) = PointOfServiceEntryMode(JsonField.of(value))
                        }

                        /** An enum containing [PointOfServiceEntryMode]'s known values. */
                        enum class Known {
                            /** Unknown */
                            UNKNOWN,
                            /** Manual key entry */
                            MANUAL,
                            /** Magnetic stripe read, without card verification value */
                            MAGNETIC_STRIPE_NO_CVV,
                            /** Optical code */
                            OPTICAL_CODE,
                            /** Contact chip card */
                            INTEGRATED_CIRCUIT_CARD,
                            /** Contactless read of chip card */
                            CONTACTLESS,
                            /**
                             * Transaction initiated using a credential that has previously been
                             * stored on file
                             */
                            CREDENTIAL_ON_FILE,
                            /** Magnetic stripe read */
                            MAGNETIC_STRIPE,
                            /** Contactless read of magnetic stripe data */
                            CONTACTLESS_MAGNETIC_STRIPE,
                            /** Contact chip card, without card verification value */
                            INTEGRATED_CIRCUIT_CARD_NO_CVV,
                        }

                        /**
                         * An enum containing [PointOfServiceEntryMode]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [PointOfServiceEntryMode] can contain an unknown value in
                         * a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Unknown */
                            UNKNOWN,
                            /** Manual key entry */
                            MANUAL,
                            /** Magnetic stripe read, without card verification value */
                            MAGNETIC_STRIPE_NO_CVV,
                            /** Optical code */
                            OPTICAL_CODE,
                            /** Contact chip card */
                            INTEGRATED_CIRCUIT_CARD,
                            /** Contactless read of chip card */
                            CONTACTLESS,
                            /**
                             * Transaction initiated using a credential that has previously been
                             * stored on file
                             */
                            CREDENTIAL_ON_FILE,
                            /** Magnetic stripe read */
                            MAGNETIC_STRIPE,
                            /** Contactless read of magnetic stripe data */
                            CONTACTLESS_MAGNETIC_STRIPE,
                            /** Contact chip card, without card verification value */
                            INTEGRATED_CIRCUIT_CARD_NO_CVV,
                            /**
                             * An enum member indicating that [PointOfServiceEntryMode] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                UNKNOWN -> Value.UNKNOWN
                                MANUAL -> Value.MANUAL
                                MAGNETIC_STRIPE_NO_CVV -> Value.MAGNETIC_STRIPE_NO_CVV
                                OPTICAL_CODE -> Value.OPTICAL_CODE
                                INTEGRATED_CIRCUIT_CARD -> Value.INTEGRATED_CIRCUIT_CARD
                                CONTACTLESS -> Value.CONTACTLESS
                                CREDENTIAL_ON_FILE -> Value.CREDENTIAL_ON_FILE
                                MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE
                                CONTACTLESS_MAGNETIC_STRIPE -> Value.CONTACTLESS_MAGNETIC_STRIPE
                                INTEGRATED_CIRCUIT_CARD_NO_CVV ->
                                    Value.INTEGRATED_CIRCUIT_CARD_NO_CVV
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                UNKNOWN -> Known.UNKNOWN
                                MANUAL -> Known.MANUAL
                                MAGNETIC_STRIPE_NO_CVV -> Known.MAGNETIC_STRIPE_NO_CVV
                                OPTICAL_CODE -> Known.OPTICAL_CODE
                                INTEGRATED_CIRCUIT_CARD -> Known.INTEGRATED_CIRCUIT_CARD
                                CONTACTLESS -> Known.CONTACTLESS
                                CREDENTIAL_ON_FILE -> Known.CREDENTIAL_ON_FILE
                                MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE
                                CONTACTLESS_MAGNETIC_STRIPE -> Known.CONTACTLESS_MAGNETIC_STRIPE
                                INTEGRATED_CIRCUIT_CARD_NO_CVV ->
                                    Known.INTEGRATED_CIRCUIT_CARD_NO_CVV
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown PointOfServiceEntryMode: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): PointOfServiceEntryMode = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is PointOfServiceEntryMode && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * Only present when `actioner: network`. Describes why a card authorization was
                     * approved or declined by Visa through stand-in processing.
                     */
                    class StandInProcessingReason
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Increase failed to process the authorization in a timely manner. */
                            @JvmField val ISSUER_ERROR = of("issuer_error")

                            /** The physical card read had an invalid CVV or dCVV. */
                            @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card")

                            /**
                             * The card's authorization request cryptogram was invalid. The
                             * cryptogram can be from a physical card or a Digital Wallet Token
                             * purchase.
                             */
                            @JvmField val INVALID_CRYPTOGRAM = of("invalid_cryptogram")

                            /** The 3DS cardholder authentication verification value was invalid. */
                            @JvmField
                            val INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE =
                                of("invalid_cardholder_authentication_verification_value")

                            /**
                             * An internal Visa error occurred. Visa uses this reason code for
                             * certain expected occurrences as well, such as Application Transaction
                             * Counter (ATC) replays.
                             */
                            @JvmField val INTERNAL_VISA_ERROR = of("internal_visa_error")

                            /**
                             * The merchant has enabled Visa's Transaction Advisory Service and
                             * requires further authentication to perform the transaction. In
                             * practice this is often utilized at fuel pumps to tell the cardholder
                             * to see the cashier.
                             */
                            @JvmField
                            val MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED =
                                of("merchant_transaction_advisory_service_authentication_required")

                            /**
                             * The transaction was blocked by Visa's Payment Fraud Disruption
                             * service due to fraudulent Acquirer behavior, such as card testing.
                             */
                            @JvmField
                            val PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK =
                                of("payment_fraud_disruption_acquirer_block")

                            /** An unspecific reason for stand-in processing. */
                            @JvmField val OTHER = of("other")

                            @JvmStatic
                            fun of(value: String) = StandInProcessingReason(JsonField.of(value))
                        }

                        /** An enum containing [StandInProcessingReason]'s known values. */
                        enum class Known {
                            /** Increase failed to process the authorization in a timely manner. */
                            ISSUER_ERROR,
                            /** The physical card read had an invalid CVV or dCVV. */
                            INVALID_PHYSICAL_CARD,
                            /**
                             * The card's authorization request cryptogram was invalid. The
                             * cryptogram can be from a physical card or a Digital Wallet Token
                             * purchase.
                             */
                            INVALID_CRYPTOGRAM,
                            /** The 3DS cardholder authentication verification value was invalid. */
                            INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE,
                            /**
                             * An internal Visa error occurred. Visa uses this reason code for
                             * certain expected occurrences as well, such as Application Transaction
                             * Counter (ATC) replays.
                             */
                            INTERNAL_VISA_ERROR,
                            /**
                             * The merchant has enabled Visa's Transaction Advisory Service and
                             * requires further authentication to perform the transaction. In
                             * practice this is often utilized at fuel pumps to tell the cardholder
                             * to see the cashier.
                             */
                            MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED,
                            /**
                             * The transaction was blocked by Visa's Payment Fraud Disruption
                             * service due to fraudulent Acquirer behavior, such as card testing.
                             */
                            PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK,
                            /** An unspecific reason for stand-in processing. */
                            OTHER,
                        }

                        /**
                         * An enum containing [StandInProcessingReason]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [StandInProcessingReason] can contain an unknown value in
                         * a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Increase failed to process the authorization in a timely manner. */
                            ISSUER_ERROR,
                            /** The physical card read had an invalid CVV or dCVV. */
                            INVALID_PHYSICAL_CARD,
                            /**
                             * The card's authorization request cryptogram was invalid. The
                             * cryptogram can be from a physical card or a Digital Wallet Token
                             * purchase.
                             */
                            INVALID_CRYPTOGRAM,
                            /** The 3DS cardholder authentication verification value was invalid. */
                            INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE,
                            /**
                             * An internal Visa error occurred. Visa uses this reason code for
                             * certain expected occurrences as well, such as Application Transaction
                             * Counter (ATC) replays.
                             */
                            INTERNAL_VISA_ERROR,
                            /**
                             * The merchant has enabled Visa's Transaction Advisory Service and
                             * requires further authentication to perform the transaction. In
                             * practice this is often utilized at fuel pumps to tell the cardholder
                             * to see the cashier.
                             */
                            MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED,
                            /**
                             * The transaction was blocked by Visa's Payment Fraud Disruption
                             * service due to fraudulent Acquirer behavior, such as card testing.
                             */
                            PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK,
                            /** An unspecific reason for stand-in processing. */
                            OTHER,
                            /**
                             * An enum member indicating that [StandInProcessingReason] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                ISSUER_ERROR -> Value.ISSUER_ERROR
                                INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD
                                INVALID_CRYPTOGRAM -> Value.INVALID_CRYPTOGRAM
                                INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE ->
                                    Value.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE
                                INTERNAL_VISA_ERROR -> Value.INTERNAL_VISA_ERROR
                                MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED ->
                                    Value
                                        .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED
                                PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK ->
                                    Value.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK
                                OTHER -> Value.OTHER
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                ISSUER_ERROR -> Known.ISSUER_ERROR
                                INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD
                                INVALID_CRYPTOGRAM -> Known.INVALID_CRYPTOGRAM
                                INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE ->
                                    Known.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE
                                INTERNAL_VISA_ERROR -> Known.INTERNAL_VISA_ERROR
                                MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED ->
                                    Known
                                        .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED
                                PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK ->
                                    Known.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK
                                OTHER -> Known.OTHER
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown StandInProcessingReason: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): StandInProcessingReason = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is StandInProcessingReason && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * The capability of the terminal being used to read the card. Shows whether a
                     * terminal can e.g., accept chip cards or if it only supports magnetic stripe
                     * reads. This reflects the highest capability of the terminal — for example, a
                     * terminal that supports both chip and magnetic stripe will be identified as
                     * chip-capable.
                     */
                    class TerminalEntryCapability
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Unknown */
                            @JvmField val UNKNOWN = of("unknown")

                            /** No terminal was used for this transaction. */
                            @JvmField val TERMINAL_NOT_USED = of("terminal_not_used")

                            /**
                             * The terminal can only read magnetic stripes and does not have chip or
                             * contactless reading capability.
                             */
                            @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe")

                            /** The terminal can only read barcodes. */
                            @JvmField val BARCODE = of("barcode")

                            /**
                             * The terminal can only read cards via Optical Character Recognition.
                             */
                            @JvmField
                            val OPTICAL_CHARACTER_RECOGNITION = of("optical_character_recognition")

                            /**
                             * The terminal supports contact chip cards and can also read the
                             * magnetic stripe. If contact chip is supported, this value is used
                             * regardless of whether contactless is also supported.
                             */
                            @JvmField val CHIP_OR_CONTACTLESS = of("chip_or_contactless")

                            /**
                             * The terminal supports contactless reads but does not support contact
                             * chip. Only used when the terminal lacks contact chip capability.
                             */
                            @JvmField val CONTACTLESS_ONLY = of("contactless_only")

                            /** The terminal has no card reading capability. */
                            @JvmField val NO_CAPABILITY = of("no_capability")

                            @JvmStatic
                            fun of(value: String) = TerminalEntryCapability(JsonField.of(value))
                        }

                        /** An enum containing [TerminalEntryCapability]'s known values. */
                        enum class Known {
                            /** Unknown */
                            UNKNOWN,
                            /** No terminal was used for this transaction. */
                            TERMINAL_NOT_USED,
                            /**
                             * The terminal can only read magnetic stripes and does not have chip or
                             * contactless reading capability.
                             */
                            MAGNETIC_STRIPE,
                            /** The terminal can only read barcodes. */
                            BARCODE,
                            /**
                             * The terminal can only read cards via Optical Character Recognition.
                             */
                            OPTICAL_CHARACTER_RECOGNITION,
                            /**
                             * The terminal supports contact chip cards and can also read the
                             * magnetic stripe. If contact chip is supported, this value is used
                             * regardless of whether contactless is also supported.
                             */
                            CHIP_OR_CONTACTLESS,
                            /**
                             * The terminal supports contactless reads but does not support contact
                             * chip. Only used when the terminal lacks contact chip capability.
                             */
                            CONTACTLESS_ONLY,
                            /** The terminal has no card reading capability. */
                            NO_CAPABILITY,
                        }

                        /**
                         * An enum containing [TerminalEntryCapability]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [TerminalEntryCapability] can contain an unknown value in
                         * a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Unknown */
                            UNKNOWN,
                            /** No terminal was used for this transaction. */
                            TERMINAL_NOT_USED,
                            /**
                             * The terminal can only read magnetic stripes and does not have chip or
                             * contactless reading capability.
                             */
                            MAGNETIC_STRIPE,
                            /** The terminal can only read barcodes. */
                            BARCODE,
                            /**
                             * The terminal can only read cards via Optical Character Recognition.
                             */
                            OPTICAL_CHARACTER_RECOGNITION,
                            /**
                             * The terminal supports contact chip cards and can also read the
                             * magnetic stripe. If contact chip is supported, this value is used
                             * regardless of whether contactless is also supported.
                             */
                            CHIP_OR_CONTACTLESS,
                            /**
                             * The terminal supports contactless reads but does not support contact
                             * chip. Only used when the terminal lacks contact chip capability.
                             */
                            CONTACTLESS_ONLY,
                            /** The terminal has no card reading capability. */
                            NO_CAPABILITY,
                            /**
                             * An enum member indicating that [TerminalEntryCapability] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                UNKNOWN -> Value.UNKNOWN
                                TERMINAL_NOT_USED -> Value.TERMINAL_NOT_USED
                                MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE
                                BARCODE -> Value.BARCODE
                                OPTICAL_CHARACTER_RECOGNITION -> Value.OPTICAL_CHARACTER_RECOGNITION
                                CHIP_OR_CONTACTLESS -> Value.CHIP_OR_CONTACTLESS
                                CONTACTLESS_ONLY -> Value.CONTACTLESS_ONLY
                                NO_CAPABILITY -> Value.NO_CAPABILITY
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                UNKNOWN -> Known.UNKNOWN
                                TERMINAL_NOT_USED -> Known.TERMINAL_NOT_USED
                                MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE
                                BARCODE -> Known.BARCODE
                                OPTICAL_CHARACTER_RECOGNITION -> Known.OPTICAL_CHARACTER_RECOGNITION
                                CHIP_OR_CONTACTLESS -> Known.CHIP_OR_CONTACTLESS
                                CONTACTLESS_ONLY -> Known.CONTACTLESS_ONLY
                                NO_CAPABILITY -> Known.NO_CAPABILITY
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown TerminalEntryCapability: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): TerminalEntryCapability = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is TerminalEntryCapability && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Visa &&
                            electronicCommerceIndicator == other.electronicCommerceIndicator &&
                            pointOfServiceEntryMode == other.pointOfServiceEntryMode &&
                            standInProcessingReason == other.standInProcessingReason &&
                            terminalEntryCapability == other.terminalEntryCapability &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            electronicCommerceIndicator,
                            pointOfServiceEntryMode,
                            standInProcessingReason,
                            terminalEntryCapability,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Visa{electronicCommerceIndicator=$electronicCommerceIndicator, pointOfServiceEntryMode=$pointOfServiceEntryMode, standInProcessingReason=$standInProcessingReason, terminalEntryCapability=$terminalEntryCapability, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is NetworkDetails &&
                        category == other.category &&
                        pulse == other.pulse &&
                        visa == other.visa &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(category, pulse, visa, additionalProperties)
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "NetworkDetails{category=$category, pulse=$pulse, visa=$visa, additionalProperties=$additionalProperties}"
            }

            /** Network-specific identifiers for a specific request or transaction. */
            class NetworkIdentifiers
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val authorizationIdentificationResponse: JsonField<String>,
                private val retrievalReferenceNumber: JsonField<String>,
                private val traceNumber: JsonField<String>,
                private val transactionId: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("authorization_identification_response")
                    @ExcludeMissing
                    authorizationIdentificationResponse: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("retrieval_reference_number")
                    @ExcludeMissing
                    retrievalReferenceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("trace_number")
                    @ExcludeMissing
                    traceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("transaction_id")
                    @ExcludeMissing
                    transactionId: JsonField<String> = JsonMissing.of(),
                ) : this(
                    authorizationIdentificationResponse,
                    retrievalReferenceNumber,
                    traceNumber,
                    transactionId,
                    mutableMapOf(),
                )

                /**
                 * The randomly generated 6-character Authorization Identification Response code
                 * sent back to the acquirer in an approved response.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun authorizationIdentificationResponse(): Optional<String> =
                    authorizationIdentificationResponse.getOptional(
                        "authorization_identification_response"
                    )

                /**
                 * A life-cycle identifier used across e.g., an authorization and a reversal.
                 * Expected to be unique per acquirer within a window of time. For some card
                 * networks the retrieval reference number includes the trace counter.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun retrievalReferenceNumber(): Optional<String> =
                    retrievalReferenceNumber.getOptional("retrieval_reference_number")

                /**
                 * A counter used to verify an individual authorization. Expected to be unique per
                 * acquirer within a window of time.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun traceNumber(): Optional<String> = traceNumber.getOptional("trace_number")

                /**
                 * A globally unique transaction identifier provided by the card network, used
                 * across multiple life-cycle requests.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun transactionId(): Optional<String> = transactionId.getOptional("transaction_id")

                /**
                 * Returns the raw JSON value of [authorizationIdentificationResponse].
                 *
                 * Unlike [authorizationIdentificationResponse], this method doesn't throw if the
                 * JSON field has an unexpected type.
                 */
                @JsonProperty("authorization_identification_response")
                @ExcludeMissing
                fun _authorizationIdentificationResponse(): JsonField<String> =
                    authorizationIdentificationResponse

                /**
                 * Returns the raw JSON value of [retrievalReferenceNumber].
                 *
                 * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field
                 * has an unexpected type.
                 */
                @JsonProperty("retrieval_reference_number")
                @ExcludeMissing
                fun _retrievalReferenceNumber(): JsonField<String> = retrievalReferenceNumber

                /**
                 * Returns the raw JSON value of [traceNumber].
                 *
                 * Unlike [traceNumber], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("trace_number")
                @ExcludeMissing
                fun _traceNumber(): JsonField<String> = traceNumber

                /**
                 * Returns the raw JSON value of [transactionId].
                 *
                 * Unlike [transactionId], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("transaction_id")
                @ExcludeMissing
                fun _transactionId(): JsonField<String> = transactionId

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of
                     * [NetworkIdentifiers].
                     *
                     * The following fields are required:
                     * ```java
                     * .authorizationIdentificationResponse()
                     * .retrievalReferenceNumber()
                     * .traceNumber()
                     * .transactionId()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [NetworkIdentifiers]. */
                class Builder internal constructor() {

                    private var authorizationIdentificationResponse: JsonField<String>? = null
                    private var retrievalReferenceNumber: JsonField<String>? = null
                    private var traceNumber: JsonField<String>? = null
                    private var transactionId: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(networkIdentifiers: NetworkIdentifiers) = apply {
                        authorizationIdentificationResponse =
                            networkIdentifiers.authorizationIdentificationResponse
                        retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber
                        traceNumber = networkIdentifiers.traceNumber
                        transactionId = networkIdentifiers.transactionId
                        additionalProperties =
                            networkIdentifiers.additionalProperties.toMutableMap()
                    }

                    /**
                     * The randomly generated 6-character Authorization Identification Response code
                     * sent back to the acquirer in an approved response.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: String?
                    ) =
                        authorizationIdentificationResponse(
                            JsonField.ofNullable(authorizationIdentificationResponse)
                        )

                    /**
                     * Alias for calling [Builder.authorizationIdentificationResponse] with
                     * `authorizationIdentificationResponse.orElse(null)`.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: Optional<String>
                    ) =
                        authorizationIdentificationResponse(
                            authorizationIdentificationResponse.getOrNull()
                        )

                    /**
                     * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON
                     * value.
                     *
                     * You should usually call [Builder.authorizationIdentificationResponse] with a
                     * well-typed [String] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: JsonField<String>
                    ) = apply {
                        this.authorizationIdentificationResponse =
                            authorizationIdentificationResponse
                    }

                    /**
                     * A life-cycle identifier used across e.g., an authorization and a reversal.
                     * Expected to be unique per acquirer within a window of time. For some card
                     * networks the retrieval reference number includes the trace counter.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: String?) =
                        retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber))

                    /**
                     * Alias for calling [Builder.retrievalReferenceNumber] with
                     * `retrievalReferenceNumber.orElse(null)`.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: Optional<String>) =
                        retrievalReferenceNumber(retrievalReferenceNumber.getOrNull())

                    /**
                     * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.retrievalReferenceNumber] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField<String>) =
                        apply {
                            this.retrievalReferenceNumber = retrievalReferenceNumber
                        }

                    /**
                     * A counter used to verify an individual authorization. Expected to be unique
                     * per acquirer within a window of time.
                     */
                    fun traceNumber(traceNumber: String?) =
                        traceNumber(JsonField.ofNullable(traceNumber))

                    /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */
                    fun traceNumber(traceNumber: Optional<String>) =
                        traceNumber(traceNumber.getOrNull())

                    /**
                     * Sets [Builder.traceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.traceNumber] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun traceNumber(traceNumber: JsonField<String>) = apply {
                        this.traceNumber = traceNumber
                    }

                    /**
                     * A globally unique transaction identifier provided by the card network, used
                     * across multiple life-cycle requests.
                     */
                    fun transactionId(transactionId: String?) =
                        transactionId(JsonField.ofNullable(transactionId))

                    /**
                     * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`.
                     */
                    fun transactionId(transactionId: Optional<String>) =
                        transactionId(transactionId.getOrNull())

                    /**
                     * Sets [Builder.transactionId] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.transactionId] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun transactionId(transactionId: JsonField<String>) = apply {
                        this.transactionId = transactionId
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [NetworkIdentifiers].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .authorizationIdentificationResponse()
                     * .retrievalReferenceNumber()
                     * .traceNumber()
                     * .transactionId()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): NetworkIdentifiers =
                        NetworkIdentifiers(
                            checkRequired(
                                "authorizationIdentificationResponse",
                                authorizationIdentificationResponse,
                            ),
                            checkRequired("retrievalReferenceNumber", retrievalReferenceNumber),
                            checkRequired("traceNumber", traceNumber),
                            checkRequired("transactionId", transactionId),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): NetworkIdentifiers = apply {
                    if (validated) {
                        return@apply
                    }

                    authorizationIdentificationResponse()
                    retrievalReferenceNumber()
                    traceNumber()
                    transactionId()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) +
                        (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) +
                        (if (traceNumber.asKnown().isPresent) 1 else 0) +
                        (if (transactionId.asKnown().isPresent) 1 else 0)

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is NetworkIdentifiers &&
                        authorizationIdentificationResponse ==
                            other.authorizationIdentificationResponse &&
                        retrievalReferenceNumber == other.retrievalReferenceNumber &&
                        traceNumber == other.traceNumber &&
                        transactionId == other.transactionId &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        authorizationIdentificationResponse,
                        retrievalReferenceNumber,
                        traceNumber,
                        transactionId,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}"
            }

            /**
             * The processing category describes the intent behind the authorization, such as
             * whether it was used for bill payments or an automatic fuel dispenser.
             */
            class ProcessingCategory
            @JsonCreator
            private constructor(private val value: JsonField<String>) : Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /**
                     * Account funding transactions are transactions used to e.g., fund an account
                     * or transfer funds between accounts.
                     */
                    @JvmField val ACCOUNT_FUNDING = of("account_funding")

                    /**
                     * Automatic fuel dispenser authorizations occur when a card is used at a gas
                     * pump, prior to the actual transaction amount being known. They are followed
                     * by an advice message that updates the amount of the pending transaction.
                     */
                    @JvmField val AUTOMATIC_FUEL_DISPENSER = of("automatic_fuel_dispenser")

                    /** A transaction used to pay a bill. */
                    @JvmField val BILL_PAYMENT = of("bill_payment")

                    /** Original credit transactions are used to send money to a cardholder. */
                    @JvmField val ORIGINAL_CREDIT = of("original_credit")

                    /** A regular purchase. */
                    @JvmField val PURCHASE = of("purchase")

                    /**
                     * Quasi-cash transactions represent purchases of items which may be convertible
                     * to cash.
                     */
                    @JvmField val QUASI_CASH = of("quasi_cash")

                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    @JvmField val REFUND = of("refund")

                    /**
                     * Cash disbursement transactions are used to withdraw cash from an ATM or a
                     * point of sale.
                     */
                    @JvmField val CASH_DISBURSEMENT = of("cash_disbursement")

                    /**
                     * Cash deposit transactions are used to deposit cash at an ATM or a point of
                     * sale.
                     */
                    @JvmField val CASH_DEPOSIT = of("cash_deposit")

                    /**
                     * A balance inquiry transaction is used to check the balance of an account
                     * associated with a card.
                     */
                    @JvmField val BALANCE_INQUIRY = of("balance_inquiry")

                    /** The processing category is unknown. */
                    @JvmField val UNKNOWN = of("unknown")

                    @JvmStatic fun of(value: String) = ProcessingCategory(JsonField.of(value))
                }

                /** An enum containing [ProcessingCategory]'s known values. */
                enum class Known {
                    /**
                     * Account funding transactions are transactions used to e.g., fund an account
                     * or transfer funds between accounts.
                     */
                    ACCOUNT_FUNDING,
                    /**
                     * Automatic fuel dispenser authorizations occur when a card is used at a gas
                     * pump, prior to the actual transaction amount being known. They are followed
                     * by an advice message that updates the amount of the pending transaction.
                     */
                    AUTOMATIC_FUEL_DISPENSER,
                    /** A transaction used to pay a bill. */
                    BILL_PAYMENT,
                    /** Original credit transactions are used to send money to a cardholder. */
                    ORIGINAL_CREDIT,
                    /** A regular purchase. */
                    PURCHASE,
                    /**
                     * Quasi-cash transactions represent purchases of items which may be convertible
                     * to cash.
                     */
                    QUASI_CASH,
                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    REFUND,
                    /**
                     * Cash disbursement transactions are used to withdraw cash from an ATM or a
                     * point of sale.
                     */
                    CASH_DISBURSEMENT,
                    /**
                     * Cash deposit transactions are used to deposit cash at an ATM or a point of
                     * sale.
                     */
                    CASH_DEPOSIT,
                    /**
                     * A balance inquiry transaction is used to check the balance of an account
                     * associated with a card.
                     */
                    BALANCE_INQUIRY,
                    /** The processing category is unknown. */
                    UNKNOWN,
                }

                /**
                 * An enum containing [ProcessingCategory]'s known values, as well as an [_UNKNOWN]
                 * member.
                 *
                 * An instance of [ProcessingCategory] can contain an unknown value in a couple of
                 * cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /**
                     * Account funding transactions are transactions used to e.g., fund an account
                     * or transfer funds between accounts.
                     */
                    ACCOUNT_FUNDING,
                    /**
                     * Automatic fuel dispenser authorizations occur when a card is used at a gas
                     * pump, prior to the actual transaction amount being known. They are followed
                     * by an advice message that updates the amount of the pending transaction.
                     */
                    AUTOMATIC_FUEL_DISPENSER,
                    /** A transaction used to pay a bill. */
                    BILL_PAYMENT,
                    /** Original credit transactions are used to send money to a cardholder. */
                    ORIGINAL_CREDIT,
                    /** A regular purchase. */
                    PURCHASE,
                    /**
                     * Quasi-cash transactions represent purchases of items which may be convertible
                     * to cash.
                     */
                    QUASI_CASH,
                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    REFUND,
                    /**
                     * Cash disbursement transactions are used to withdraw cash from an ATM or a
                     * point of sale.
                     */
                    CASH_DISBURSEMENT,
                    /**
                     * Cash deposit transactions are used to deposit cash at an ATM or a point of
                     * sale.
                     */
                    CASH_DEPOSIT,
                    /**
                     * A balance inquiry transaction is used to check the balance of an account
                     * associated with a card.
                     */
                    BALANCE_INQUIRY,
                    /** The processing category is unknown. */
                    UNKNOWN,
                    /**
                     * An enum member indicating that [ProcessingCategory] was instantiated with an
                     * unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        ACCOUNT_FUNDING -> Value.ACCOUNT_FUNDING
                        AUTOMATIC_FUEL_DISPENSER -> Value.AUTOMATIC_FUEL_DISPENSER
                        BILL_PAYMENT -> Value.BILL_PAYMENT
                        ORIGINAL_CREDIT -> Value.ORIGINAL_CREDIT
                        PURCHASE -> Value.PURCHASE
                        QUASI_CASH -> Value.QUASI_CASH
                        REFUND -> Value.REFUND
                        CASH_DISBURSEMENT -> Value.CASH_DISBURSEMENT
                        CASH_DEPOSIT -> Value.CASH_DEPOSIT
                        BALANCE_INQUIRY -> Value.BALANCE_INQUIRY
                        UNKNOWN -> Value.UNKNOWN
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        ACCOUNT_FUNDING -> Known.ACCOUNT_FUNDING
                        AUTOMATIC_FUEL_DISPENSER -> Known.AUTOMATIC_FUEL_DISPENSER
                        BILL_PAYMENT -> Known.BILL_PAYMENT
                        ORIGINAL_CREDIT -> Known.ORIGINAL_CREDIT
                        PURCHASE -> Known.PURCHASE
                        QUASI_CASH -> Known.QUASI_CASH
                        REFUND -> Known.REFUND
                        CASH_DISBURSEMENT -> Known.CASH_DISBURSEMENT
                        CASH_DEPOSIT -> Known.CASH_DEPOSIT
                        BALANCE_INQUIRY -> Known.BALANCE_INQUIRY
                        UNKNOWN -> Known.UNKNOWN
                        else ->
                            throw IncreaseInvalidDataException("Unknown ProcessingCategory: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): ProcessingCategory = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is ProcessingCategory && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            class SchemeFee
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val amount: JsonField<String>,
                private val createdAt: JsonField<OffsetDateTime>,
                private val currency: JsonField<Currency>,
                private val feeType: JsonField<FeeType>,
                private val fixedComponent: JsonField<String>,
                private val variableRate: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("amount")
                    @ExcludeMissing
                    amount: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("created_at")
                    @ExcludeMissing
                    createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                    @JsonProperty("currency")
                    @ExcludeMissing
                    currency: JsonField<Currency> = JsonMissing.of(),
                    @JsonProperty("fee_type")
                    @ExcludeMissing
                    feeType: JsonField<FeeType> = JsonMissing.of(),
                    @JsonProperty("fixed_component")
                    @ExcludeMissing
                    fixedComponent: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("variable_rate")
                    @ExcludeMissing
                    variableRate: JsonField<String> = JsonMissing.of(),
                ) : this(
                    amount,
                    createdAt,
                    currency,
                    feeType,
                    fixedComponent,
                    variableRate,
                    mutableMapOf(),
                )

                /**
                 * The fee amount given as a string containing a decimal number.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun amount(): String = amount.getRequired("amount")

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was
                 * created.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /**
                 * The type of fee being assessed.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun feeType(): FeeType = feeType.getRequired("fee_type")

                /**
                 * The fixed component of the fee, if applicable, given in major units of the fee
                 * amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun fixedComponent(): Optional<String> =
                    fixedComponent.getOptional("fixed_component")

                /**
                 * The variable rate component of the fee, if applicable, given as a decimal (e.g.,
                 * 0.015 for 1.5%).
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun variableRate(): Optional<String> = variableRate.getOptional("variable_rate")

                /**
                 * Returns the raw JSON value of [amount].
                 *
                 * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<String> = amount

                /**
                 * Returns the raw JSON value of [createdAt].
                 *
                 * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("created_at")
                @ExcludeMissing
                fun _createdAt(): JsonField<OffsetDateTime> = createdAt

                /**
                 * Returns the raw JSON value of [currency].
                 *
                 * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun _currency(): JsonField<Currency> = currency

                /**
                 * Returns the raw JSON value of [feeType].
                 *
                 * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("fee_type")
                @ExcludeMissing
                fun _feeType(): JsonField<FeeType> = feeType

                /**
                 * Returns the raw JSON value of [fixedComponent].
                 *
                 * Unlike [fixedComponent], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("fixed_component")
                @ExcludeMissing
                fun _fixedComponent(): JsonField<String> = fixedComponent

                /**
                 * Returns the raw JSON value of [variableRate].
                 *
                 * Unlike [variableRate], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("variable_rate")
                @ExcludeMissing
                fun _variableRate(): JsonField<String> = variableRate

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [SchemeFee].
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [SchemeFee]. */
                class Builder internal constructor() {

                    private var amount: JsonField<String>? = null
                    private var createdAt: JsonField<OffsetDateTime>? = null
                    private var currency: JsonField<Currency>? = null
                    private var feeType: JsonField<FeeType>? = null
                    private var fixedComponent: JsonField<String>? = null
                    private var variableRate: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(schemeFee: SchemeFee) = apply {
                        amount = schemeFee.amount
                        createdAt = schemeFee.createdAt
                        currency = schemeFee.currency
                        feeType = schemeFee.feeType
                        fixedComponent = schemeFee.fixedComponent
                        variableRate = schemeFee.variableRate
                        additionalProperties = schemeFee.additionalProperties.toMutableMap()
                    }

                    /** The fee amount given as a string containing a decimal number. */
                    fun amount(amount: String) = amount(JsonField.of(amount))

                    /**
                     * Sets [Builder.amount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.amount] with a well-typed [String] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun amount(amount: JsonField<String>) = apply { this.amount = amount }

                    /**
                     * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee
                     * was created.
                     */
                    fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt))

                    /**
                     * Sets [Builder.createdAt] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.createdAt] with a well-typed
                     * [OffsetDateTime] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply {
                        this.createdAt = createdAt
                    }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                     * reimbursement.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * Sets [Builder.currency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.currency] with a well-typed [Currency] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                    /** The type of fee being assessed. */
                    fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType))

                    /**
                     * Sets [Builder.feeType] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.feeType] with a well-typed [FeeType] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun feeType(feeType: JsonField<FeeType>) = apply { this.feeType = feeType }

                    /**
                     * The fixed component of the fee, if applicable, given in major units of the
                     * fee amount.
                     */
                    fun fixedComponent(fixedComponent: String?) =
                        fixedComponent(JsonField.ofNullable(fixedComponent))

                    /**
                     * Alias for calling [Builder.fixedComponent] with
                     * `fixedComponent.orElse(null)`.
                     */
                    fun fixedComponent(fixedComponent: Optional<String>) =
                        fixedComponent(fixedComponent.getOrNull())

                    /**
                     * Sets [Builder.fixedComponent] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.fixedComponent] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun fixedComponent(fixedComponent: JsonField<String>) = apply {
                        this.fixedComponent = fixedComponent
                    }

                    /**
                     * The variable rate component of the fee, if applicable, given as a decimal
                     * (e.g., 0.015 for 1.5%).
                     */
                    fun variableRate(variableRate: String?) =
                        variableRate(JsonField.ofNullable(variableRate))

                    /**
                     * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`.
                     */
                    fun variableRate(variableRate: Optional<String>) =
                        variableRate(variableRate.getOrNull())

                    /**
                     * Sets [Builder.variableRate] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.variableRate] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun variableRate(variableRate: JsonField<String>) = apply {
                        this.variableRate = variableRate
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [SchemeFee].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): SchemeFee =
                        SchemeFee(
                            checkRequired("amount", amount),
                            checkRequired("createdAt", createdAt),
                            checkRequired("currency", currency),
                            checkRequired("feeType", feeType),
                            checkRequired("fixedComponent", fixedComponent),
                            checkRequired("variableRate", variableRate),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): SchemeFee = apply {
                    if (validated) {
                        return@apply
                    }

                    amount()
                    createdAt()
                    currency().validate()
                    feeType().validate()
                    fixedComponent()
                    variableRate()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (amount.asKnown().isPresent) 1 else 0) +
                        (if (createdAt.asKnown().isPresent) 1 else 0) +
                        (currency.asKnown().getOrNull()?.validity() ?: 0) +
                        (feeType.asKnown().getOrNull()?.validity() ?: 0) +
                        (if (fixedComponent.asKnown().isPresent) 1 else 0) +
                        (if (variableRate.asKnown().isPresent) 1 else 0)

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 */
                class Currency
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** US Dollar (USD) */
                        @JvmField val USD = of("USD")

                        @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                    }

                    /** An enum containing [Currency]'s known values. */
                    enum class Known {
                        /** US Dollar (USD) */
                        USD
                    }

                    /**
                     * An enum containing [Currency]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Currency] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** US Dollar (USD) */
                        USD,
                        /**
                         * An enum member indicating that [Currency] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            USD -> Value.USD
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            USD -> Known.USD
                            else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Currency = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Currency && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** The type of fee being assessed. */
                class FeeType
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY =
                            of("visa_international_service_assessment_single_currency")

                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY =
                            of("visa_international_service_assessment_cross_currency")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE =
                            of("visa_authorization_domestic_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_international_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE =
                            of("visa_authorization_canada_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_international_point_of_sale")

                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE =
                            of("visa_authorization_address_verification_service")

                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        @JvmField
                        val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization")

                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission")

                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_DOMESTIC =
                            of("visa_account_verification_domestic")

                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL =
                            of("visa_account_verification_international")

                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_CANADA =
                            of("visa_account_verification_canada")

                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee")

                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        @JvmField
                        val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE =
                            of("visa_consumer_debit_acceptance_fee")

                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        @JvmField
                        val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE =
                            of("visa_business_debit_acceptance_fee")

                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee")

                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic")

                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        @JvmField
                        val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international")

                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token")

                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token")

                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission")

                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization")

                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        @JvmField
                        val VISA_DIRECT_TRANSACTION_DOMESTIC =
                            of("visa_direct_transaction_domestic")

                        /** Issuer card service fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit")

                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT =
                            of("visa_advertising_service_commercial_credit")

                        /** Issuer Community Growth Acceleration Program Fee. */
                        @JvmField
                        val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM =
                            of("visa_community_growth_acceleration_program")

                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        @JvmField
                        val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT =
                            of("visa_processing_guarantee_commercial_credit")

                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee")

                        @JvmStatic fun of(value: String) = FeeType(JsonField.of(value))
                    }

                    /** An enum containing [FeeType]'s known values. */
                    enum class Known {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                    }

                    /**
                     * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member.
                     *
                     * An instance of [FeeType] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                        /**
                         * An enum member indicating that [FeeType] was instantiated with an unknown
                         * value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Value.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Value.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Known.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Known.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE
                            else -> throw IncreaseInvalidDataException("Unknown FeeType: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): FeeType = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is FeeType && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is SchemeFee &&
                        amount == other.amount &&
                        createdAt == other.createdAt &&
                        currency == other.currency &&
                        feeType == other.feeType &&
                        fixedComponent == other.fixedComponent &&
                        variableRate == other.variableRate &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        amount,
                        createdAt,
                        currency,
                        feeType,
                        fixedComponent,
                        variableRate,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}"
            }

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_authorization`.
             */
            class Type @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    @JvmField val CARD_AUTHORIZATION = of("card_authorization")

                    @JvmStatic fun of(value: String) = Type(JsonField.of(value))
                }

                /** An enum containing [Type]'s known values. */
                enum class Known {
                    CARD_AUTHORIZATION
                }

                /**
                 * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Type] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    CARD_AUTHORIZATION,
                    /**
                     * An enum member indicating that [Type] was instantiated with an unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        CARD_AUTHORIZATION -> Value.CARD_AUTHORIZATION
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        CARD_AUTHORIZATION -> Known.CARD_AUTHORIZATION
                        else -> throw IncreaseInvalidDataException("Unknown Type: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Type = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Type && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** Fields related to verification of cardholder-provided values. */
            class Verification
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val cardVerificationCode: JsonField<CardVerificationCode>,
                private val cardholderAddress: JsonField<CardholderAddress>,
                private val cardholderName: JsonField<CardholderName>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("card_verification_code")
                    @ExcludeMissing
                    cardVerificationCode: JsonField<CardVerificationCode> = JsonMissing.of(),
                    @JsonProperty("cardholder_address")
                    @ExcludeMissing
                    cardholderAddress: JsonField<CardholderAddress> = JsonMissing.of(),
                    @JsonProperty("cardholder_name")
                    @ExcludeMissing
                    cardholderName: JsonField<CardholderName> = JsonMissing.of(),
                ) : this(cardVerificationCode, cardholderAddress, cardholderName, mutableMapOf())

                /**
                 * Fields related to verification of the Card Verification Code, a 3-digit code on
                 * the back of the card.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun cardVerificationCode(): CardVerificationCode =
                    cardVerificationCode.getRequired("card_verification_code")

                /**
                 * Cardholder address provided in the authorization request and the address on file
                 * we verified it against.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun cardholderAddress(): CardholderAddress =
                    cardholderAddress.getRequired("cardholder_address")

                /**
                 * Cardholder name provided in the authorization request.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun cardholderName(): Optional<CardholderName> =
                    cardholderName.getOptional("cardholder_name")

                /**
                 * Returns the raw JSON value of [cardVerificationCode].
                 *
                 * Unlike [cardVerificationCode], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("card_verification_code")
                @ExcludeMissing
                fun _cardVerificationCode(): JsonField<CardVerificationCode> = cardVerificationCode

                /**
                 * Returns the raw JSON value of [cardholderAddress].
                 *
                 * Unlike [cardholderAddress], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("cardholder_address")
                @ExcludeMissing
                fun _cardholderAddress(): JsonField<CardholderAddress> = cardholderAddress

                /**
                 * Returns the raw JSON value of [cardholderName].
                 *
                 * Unlike [cardholderName], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("cardholder_name")
                @ExcludeMissing
                fun _cardholderName(): JsonField<CardholderName> = cardholderName

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [Verification].
                     *
                     * The following fields are required:
                     * ```java
                     * .cardVerificationCode()
                     * .cardholderAddress()
                     * .cardholderName()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [Verification]. */
                class Builder internal constructor() {

                    private var cardVerificationCode: JsonField<CardVerificationCode>? = null
                    private var cardholderAddress: JsonField<CardholderAddress>? = null
                    private var cardholderName: JsonField<CardholderName>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(verification: Verification) = apply {
                        cardVerificationCode = verification.cardVerificationCode
                        cardholderAddress = verification.cardholderAddress
                        cardholderName = verification.cardholderName
                        additionalProperties = verification.additionalProperties.toMutableMap()
                    }

                    /**
                     * Fields related to verification of the Card Verification Code, a 3-digit code
                     * on the back of the card.
                     */
                    fun cardVerificationCode(cardVerificationCode: CardVerificationCode) =
                        cardVerificationCode(JsonField.of(cardVerificationCode))

                    /**
                     * Sets [Builder.cardVerificationCode] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.cardVerificationCode] with a well-typed
                     * [CardVerificationCode] value instead. This method is primarily for setting
                     * the field to an undocumented or not yet supported value.
                     */
                    fun cardVerificationCode(
                        cardVerificationCode: JsonField<CardVerificationCode>
                    ) = apply { this.cardVerificationCode = cardVerificationCode }

                    /**
                     * Cardholder address provided in the authorization request and the address on
                     * file we verified it against.
                     */
                    fun cardholderAddress(cardholderAddress: CardholderAddress) =
                        cardholderAddress(JsonField.of(cardholderAddress))

                    /**
                     * Sets [Builder.cardholderAddress] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.cardholderAddress] with a well-typed
                     * [CardholderAddress] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun cardholderAddress(cardholderAddress: JsonField<CardholderAddress>) = apply {
                        this.cardholderAddress = cardholderAddress
                    }

                    /** Cardholder name provided in the authorization request. */
                    fun cardholderName(cardholderName: CardholderName?) =
                        cardholderName(JsonField.ofNullable(cardholderName))

                    /**
                     * Alias for calling [Builder.cardholderName] with
                     * `cardholderName.orElse(null)`.
                     */
                    fun cardholderName(cardholderName: Optional<CardholderName>) =
                        cardholderName(cardholderName.getOrNull())

                    /**
                     * Sets [Builder.cardholderName] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.cardholderName] with a well-typed
                     * [CardholderName] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun cardholderName(cardholderName: JsonField<CardholderName>) = apply {
                        this.cardholderName = cardholderName
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [Verification].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .cardVerificationCode()
                     * .cardholderAddress()
                     * .cardholderName()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): Verification =
                        Verification(
                            checkRequired("cardVerificationCode", cardVerificationCode),
                            checkRequired("cardholderAddress", cardholderAddress),
                            checkRequired("cardholderName", cardholderName),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Verification = apply {
                    if (validated) {
                        return@apply
                    }

                    cardVerificationCode().validate()
                    cardholderAddress().validate()
                    cardholderName().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (cardVerificationCode.asKnown().getOrNull()?.validity() ?: 0) +
                        (cardholderAddress.asKnown().getOrNull()?.validity() ?: 0) +
                        (cardholderName.asKnown().getOrNull()?.validity() ?: 0)

                /**
                 * Fields related to verification of the Card Verification Code, a 3-digit code on
                 * the back of the card.
                 */
                class CardVerificationCode
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val result: JsonField<Result>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("result")
                        @ExcludeMissing
                        result: JsonField<Result> = JsonMissing.of()
                    ) : this(result, mutableMapOf())

                    /**
                     * The result of verifying the Card Verification Code.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun result(): Result = result.getRequired("result")

                    /**
                     * Returns the raw JSON value of [result].
                     *
                     * Unlike [result], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("result")
                    @ExcludeMissing
                    fun _result(): JsonField<Result> = result

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [CardVerificationCode].
                         *
                         * The following fields are required:
                         * ```java
                         * .result()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CardVerificationCode]. */
                    class Builder internal constructor() {

                        private var result: JsonField<Result>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(cardVerificationCode: CardVerificationCode) = apply {
                            result = cardVerificationCode.result
                            additionalProperties =
                                cardVerificationCode.additionalProperties.toMutableMap()
                        }

                        /** The result of verifying the Card Verification Code. */
                        fun result(result: Result) = result(JsonField.of(result))

                        /**
                         * Sets [Builder.result] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.result] with a well-typed [Result] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun result(result: JsonField<Result>) = apply { this.result = result }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CardVerificationCode].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .result()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CardVerificationCode =
                            CardVerificationCode(
                                checkRequired("result", result),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CardVerificationCode = apply {
                        if (validated) {
                            return@apply
                        }

                        result().validate()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0)

                    /** The result of verifying the Card Verification Code. */
                    class Result
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /**
                             * No card verification code was provided in the authorization request.
                             */
                            @JvmField val NOT_CHECKED = of("not_checked")

                            /** The card verification code matched the one on file. */
                            @JvmField val MATCH = of("match")

                            /** The card verification code did not match the one on file. */
                            @JvmField val NO_MATCH = of("no_match")

                            @JvmStatic fun of(value: String) = Result(JsonField.of(value))
                        }

                        /** An enum containing [Result]'s known values. */
                        enum class Known {
                            /**
                             * No card verification code was provided in the authorization request.
                             */
                            NOT_CHECKED,
                            /** The card verification code matched the one on file. */
                            MATCH,
                            /** The card verification code did not match the one on file. */
                            NO_MATCH,
                        }

                        /**
                         * An enum containing [Result]'s known values, as well as an [_UNKNOWN]
                         * member.
                         *
                         * An instance of [Result] can contain an unknown value in a couple of
                         * cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /**
                             * No card verification code was provided in the authorization request.
                             */
                            NOT_CHECKED,
                            /** The card verification code matched the one on file. */
                            MATCH,
                            /** The card verification code did not match the one on file. */
                            NO_MATCH,
                            /**
                             * An enum member indicating that [Result] was instantiated with an
                             * unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NOT_CHECKED -> Value.NOT_CHECKED
                                MATCH -> Value.MATCH
                                NO_MATCH -> Value.NO_MATCH
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NOT_CHECKED -> Known.NOT_CHECKED
                                MATCH -> Known.MATCH
                                NO_MATCH -> Known.NO_MATCH
                                else -> throw IncreaseInvalidDataException("Unknown Result: $value")
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): Result = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is Result && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CardVerificationCode &&
                            result == other.result &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}"
                }

                /**
                 * Cardholder address provided in the authorization request and the address on file
                 * we verified it against.
                 */
                class CardholderAddress
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val actualLine1: JsonField<String>,
                    private val actualPostalCode: JsonField<String>,
                    private val providedLine1: JsonField<String>,
                    private val providedPostalCode: JsonField<String>,
                    private val result: JsonField<Result>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("actual_line1")
                        @ExcludeMissing
                        actualLine1: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("actual_postal_code")
                        @ExcludeMissing
                        actualPostalCode: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_line1")
                        @ExcludeMissing
                        providedLine1: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_postal_code")
                        @ExcludeMissing
                        providedPostalCode: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("result")
                        @ExcludeMissing
                        result: JsonField<Result> = JsonMissing.of(),
                    ) : this(
                        actualLine1,
                        actualPostalCode,
                        providedLine1,
                        providedPostalCode,
                        result,
                        mutableMapOf(),
                    )

                    /**
                     * Line 1 of the address on file for the cardholder.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun actualLine1(): Optional<String> = actualLine1.getOptional("actual_line1")

                    /**
                     * The postal code of the address on file for the cardholder.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun actualPostalCode(): Optional<String> =
                        actualPostalCode.getOptional("actual_postal_code")

                    /**
                     * The cardholder address line 1 provided for verification in the authorization
                     * request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedLine1(): Optional<String> =
                        providedLine1.getOptional("provided_line1")

                    /**
                     * The postal code provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedPostalCode(): Optional<String> =
                        providedPostalCode.getOptional("provided_postal_code")

                    /**
                     * The address verification result returned to the card network.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun result(): Result = result.getRequired("result")

                    /**
                     * Returns the raw JSON value of [actualLine1].
                     *
                     * Unlike [actualLine1], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("actual_line1")
                    @ExcludeMissing
                    fun _actualLine1(): JsonField<String> = actualLine1

                    /**
                     * Returns the raw JSON value of [actualPostalCode].
                     *
                     * Unlike [actualPostalCode], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("actual_postal_code")
                    @ExcludeMissing
                    fun _actualPostalCode(): JsonField<String> = actualPostalCode

                    /**
                     * Returns the raw JSON value of [providedLine1].
                     *
                     * Unlike [providedLine1], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("provided_line1")
                    @ExcludeMissing
                    fun _providedLine1(): JsonField<String> = providedLine1

                    /**
                     * Returns the raw JSON value of [providedPostalCode].
                     *
                     * Unlike [providedPostalCode], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("provided_postal_code")
                    @ExcludeMissing
                    fun _providedPostalCode(): JsonField<String> = providedPostalCode

                    /**
                     * Returns the raw JSON value of [result].
                     *
                     * Unlike [result], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("result")
                    @ExcludeMissing
                    fun _result(): JsonField<Result> = result

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [CardholderAddress].
                         *
                         * The following fields are required:
                         * ```java
                         * .actualLine1()
                         * .actualPostalCode()
                         * .providedLine1()
                         * .providedPostalCode()
                         * .result()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CardholderAddress]. */
                    class Builder internal constructor() {

                        private var actualLine1: JsonField<String>? = null
                        private var actualPostalCode: JsonField<String>? = null
                        private var providedLine1: JsonField<String>? = null
                        private var providedPostalCode: JsonField<String>? = null
                        private var result: JsonField<Result>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(cardholderAddress: CardholderAddress) = apply {
                            actualLine1 = cardholderAddress.actualLine1
                            actualPostalCode = cardholderAddress.actualPostalCode
                            providedLine1 = cardholderAddress.providedLine1
                            providedPostalCode = cardholderAddress.providedPostalCode
                            result = cardholderAddress.result
                            additionalProperties =
                                cardholderAddress.additionalProperties.toMutableMap()
                        }

                        /** Line 1 of the address on file for the cardholder. */
                        fun actualLine1(actualLine1: String?) =
                            actualLine1(JsonField.ofNullable(actualLine1))

                        /**
                         * Alias for calling [Builder.actualLine1] with `actualLine1.orElse(null)`.
                         */
                        fun actualLine1(actualLine1: Optional<String>) =
                            actualLine1(actualLine1.getOrNull())

                        /**
                         * Sets [Builder.actualLine1] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.actualLine1] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun actualLine1(actualLine1: JsonField<String>) = apply {
                            this.actualLine1 = actualLine1
                        }

                        /** The postal code of the address on file for the cardholder. */
                        fun actualPostalCode(actualPostalCode: String?) =
                            actualPostalCode(JsonField.ofNullable(actualPostalCode))

                        /**
                         * Alias for calling [Builder.actualPostalCode] with
                         * `actualPostalCode.orElse(null)`.
                         */
                        fun actualPostalCode(actualPostalCode: Optional<String>) =
                            actualPostalCode(actualPostalCode.getOrNull())

                        /**
                         * Sets [Builder.actualPostalCode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.actualPostalCode] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun actualPostalCode(actualPostalCode: JsonField<String>) = apply {
                            this.actualPostalCode = actualPostalCode
                        }

                        /**
                         * The cardholder address line 1 provided for verification in the
                         * authorization request.
                         */
                        fun providedLine1(providedLine1: String?) =
                            providedLine1(JsonField.ofNullable(providedLine1))

                        /**
                         * Alias for calling [Builder.providedLine1] with
                         * `providedLine1.orElse(null)`.
                         */
                        fun providedLine1(providedLine1: Optional<String>) =
                            providedLine1(providedLine1.getOrNull())

                        /**
                         * Sets [Builder.providedLine1] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedLine1] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedLine1(providedLine1: JsonField<String>) = apply {
                            this.providedLine1 = providedLine1
                        }

                        /**
                         * The postal code provided for verification in the authorization request.
                         */
                        fun providedPostalCode(providedPostalCode: String?) =
                            providedPostalCode(JsonField.ofNullable(providedPostalCode))

                        /**
                         * Alias for calling [Builder.providedPostalCode] with
                         * `providedPostalCode.orElse(null)`.
                         */
                        fun providedPostalCode(providedPostalCode: Optional<String>) =
                            providedPostalCode(providedPostalCode.getOrNull())

                        /**
                         * Sets [Builder.providedPostalCode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedPostalCode] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedPostalCode(providedPostalCode: JsonField<String>) = apply {
                            this.providedPostalCode = providedPostalCode
                        }

                        /** The address verification result returned to the card network. */
                        fun result(result: Result) = result(JsonField.of(result))

                        /**
                         * Sets [Builder.result] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.result] with a well-typed [Result] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun result(result: JsonField<Result>) = apply { this.result = result }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CardholderAddress].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .actualLine1()
                         * .actualPostalCode()
                         * .providedLine1()
                         * .providedPostalCode()
                         * .result()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CardholderAddress =
                            CardholderAddress(
                                checkRequired("actualLine1", actualLine1),
                                checkRequired("actualPostalCode", actualPostalCode),
                                checkRequired("providedLine1", providedLine1),
                                checkRequired("providedPostalCode", providedPostalCode),
                                checkRequired("result", result),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CardholderAddress = apply {
                        if (validated) {
                            return@apply
                        }

                        actualLine1()
                        actualPostalCode()
                        providedLine1()
                        providedPostalCode()
                        result().validate()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (actualLine1.asKnown().isPresent) 1 else 0) +
                            (if (actualPostalCode.asKnown().isPresent) 1 else 0) +
                            (if (providedLine1.asKnown().isPresent) 1 else 0) +
                            (if (providedPostalCode.asKnown().isPresent) 1 else 0) +
                            (result.asKnown().getOrNull()?.validity() ?: 0)

                    /** The address verification result returned to the card network. */
                    class Result
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** No address information was provided in the authorization request. */
                            @JvmField val NOT_CHECKED = of("not_checked")

                            /**
                             * Postal code matches, but the street address does not match or was not
                             * provided.
                             */
                            @JvmField
                            val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH =
                                of("postal_code_match_address_no_match")

                            /**
                             * Postal code does not match, but the street address matches or was not
                             * provided.
                             */
                            @JvmField
                            val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH =
                                of("postal_code_no_match_address_match")

                            /** Postal code and street address match. */
                            @JvmField val MATCH = of("match")

                            /** Postal code and street address do not match. */
                            @JvmField val NO_MATCH = of("no_match")

                            /**
                             * Postal code matches, but the street address was not verified.
                             * (deprecated)
                             */
                            @JvmField
                            val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED =
                                of("postal_code_match_address_not_checked")

                            @JvmStatic fun of(value: String) = Result(JsonField.of(value))
                        }

                        /** An enum containing [Result]'s known values. */
                        enum class Known {
                            /** No address information was provided in the authorization request. */
                            NOT_CHECKED,
                            /**
                             * Postal code matches, but the street address does not match or was not
                             * provided.
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NO_MATCH,
                            /**
                             * Postal code does not match, but the street address matches or was not
                             * provided.
                             */
                            POSTAL_CODE_NO_MATCH_ADDRESS_MATCH,
                            /** Postal code and street address match. */
                            MATCH,
                            /** Postal code and street address do not match. */
                            NO_MATCH,
                            /**
                             * Postal code matches, but the street address was not verified.
                             * (deprecated)
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED,
                        }

                        /**
                         * An enum containing [Result]'s known values, as well as an [_UNKNOWN]
                         * member.
                         *
                         * An instance of [Result] can contain an unknown value in a couple of
                         * cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** No address information was provided in the authorization request. */
                            NOT_CHECKED,
                            /**
                             * Postal code matches, but the street address does not match or was not
                             * provided.
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NO_MATCH,
                            /**
                             * Postal code does not match, but the street address matches or was not
                             * provided.
                             */
                            POSTAL_CODE_NO_MATCH_ADDRESS_MATCH,
                            /** Postal code and street address match. */
                            MATCH,
                            /** Postal code and street address do not match. */
                            NO_MATCH,
                            /**
                             * Postal code matches, but the street address was not verified.
                             * (deprecated)
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED,
                            /**
                             * An enum member indicating that [Result] was instantiated with an
                             * unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NOT_CHECKED -> Value.NOT_CHECKED
                                POSTAL_CODE_MATCH_ADDRESS_NO_MATCH ->
                                    Value.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH
                                POSTAL_CODE_NO_MATCH_ADDRESS_MATCH ->
                                    Value.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH
                                MATCH -> Value.MATCH
                                NO_MATCH -> Value.NO_MATCH
                                POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED ->
                                    Value.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NOT_CHECKED -> Known.NOT_CHECKED
                                POSTAL_CODE_MATCH_ADDRESS_NO_MATCH ->
                                    Known.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH
                                POSTAL_CODE_NO_MATCH_ADDRESS_MATCH ->
                                    Known.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH
                                MATCH -> Known.MATCH
                                NO_MATCH -> Known.NO_MATCH
                                POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED ->
                                    Known.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED
                                else -> throw IncreaseInvalidDataException("Unknown Result: $value")
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): Result = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is Result && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CardholderAddress &&
                            actualLine1 == other.actualLine1 &&
                            actualPostalCode == other.actualPostalCode &&
                            providedLine1 == other.providedLine1 &&
                            providedPostalCode == other.providedPostalCode &&
                            result == other.result &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            actualLine1,
                            actualPostalCode,
                            providedLine1,
                            providedPostalCode,
                            result,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}"
                }

                /** Cardholder name provided in the authorization request. */
                class CardholderName
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val providedFirstName: JsonField<String>,
                    private val providedLastName: JsonField<String>,
                    private val providedMiddleName: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("provided_first_name")
                        @ExcludeMissing
                        providedFirstName: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_last_name")
                        @ExcludeMissing
                        providedLastName: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_middle_name")
                        @ExcludeMissing
                        providedMiddleName: JsonField<String> = JsonMissing.of(),
                    ) : this(
                        providedFirstName,
                        providedLastName,
                        providedMiddleName,
                        mutableMapOf(),
                    )

                    /**
                     * The first name provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedFirstName(): Optional<String> =
                        providedFirstName.getOptional("provided_first_name")

                    /**
                     * The last name provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedLastName(): Optional<String> =
                        providedLastName.getOptional("provided_last_name")

                    /**
                     * The middle name provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedMiddleName(): Optional<String> =
                        providedMiddleName.getOptional("provided_middle_name")

                    /**
                     * Returns the raw JSON value of [providedFirstName].
                     *
                     * Unlike [providedFirstName], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("provided_first_name")
                    @ExcludeMissing
                    fun _providedFirstName(): JsonField<String> = providedFirstName

                    /**
                     * Returns the raw JSON value of [providedLastName].
                     *
                     * Unlike [providedLastName], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("provided_last_name")
                    @ExcludeMissing
                    fun _providedLastName(): JsonField<String> = providedLastName

                    /**
                     * Returns the raw JSON value of [providedMiddleName].
                     *
                     * Unlike [providedMiddleName], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("provided_middle_name")
                    @ExcludeMissing
                    fun _providedMiddleName(): JsonField<String> = providedMiddleName

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [CardholderName].
                         *
                         * The following fields are required:
                         * ```java
                         * .providedFirstName()
                         * .providedLastName()
                         * .providedMiddleName()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CardholderName]. */
                    class Builder internal constructor() {

                        private var providedFirstName: JsonField<String>? = null
                        private var providedLastName: JsonField<String>? = null
                        private var providedMiddleName: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(cardholderName: CardholderName) = apply {
                            providedFirstName = cardholderName.providedFirstName
                            providedLastName = cardholderName.providedLastName
                            providedMiddleName = cardholderName.providedMiddleName
                            additionalProperties =
                                cardholderName.additionalProperties.toMutableMap()
                        }

                        /**
                         * The first name provided for verification in the authorization request.
                         */
                        fun providedFirstName(providedFirstName: String?) =
                            providedFirstName(JsonField.ofNullable(providedFirstName))

                        /**
                         * Alias for calling [Builder.providedFirstName] with
                         * `providedFirstName.orElse(null)`.
                         */
                        fun providedFirstName(providedFirstName: Optional<String>) =
                            providedFirstName(providedFirstName.getOrNull())

                        /**
                         * Sets [Builder.providedFirstName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedFirstName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedFirstName(providedFirstName: JsonField<String>) = apply {
                            this.providedFirstName = providedFirstName
                        }

                        /** The last name provided for verification in the authorization request. */
                        fun providedLastName(providedLastName: String?) =
                            providedLastName(JsonField.ofNullable(providedLastName))

                        /**
                         * Alias for calling [Builder.providedLastName] with
                         * `providedLastName.orElse(null)`.
                         */
                        fun providedLastName(providedLastName: Optional<String>) =
                            providedLastName(providedLastName.getOrNull())

                        /**
                         * Sets [Builder.providedLastName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedLastName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedLastName(providedLastName: JsonField<String>) = apply {
                            this.providedLastName = providedLastName
                        }

                        /**
                         * The middle name provided for verification in the authorization request.
                         */
                        fun providedMiddleName(providedMiddleName: String?) =
                            providedMiddleName(JsonField.ofNullable(providedMiddleName))

                        /**
                         * Alias for calling [Builder.providedMiddleName] with
                         * `providedMiddleName.orElse(null)`.
                         */
                        fun providedMiddleName(providedMiddleName: Optional<String>) =
                            providedMiddleName(providedMiddleName.getOrNull())

                        /**
                         * Sets [Builder.providedMiddleName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedMiddleName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedMiddleName(providedMiddleName: JsonField<String>) = apply {
                            this.providedMiddleName = providedMiddleName
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CardholderName].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .providedFirstName()
                         * .providedLastName()
                         * .providedMiddleName()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CardholderName =
                            CardholderName(
                                checkRequired("providedFirstName", providedFirstName),
                                checkRequired("providedLastName", providedLastName),
                                checkRequired("providedMiddleName", providedMiddleName),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CardholderName = apply {
                        if (validated) {
                            return@apply
                        }

                        providedFirstName()
                        providedLastName()
                        providedMiddleName()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (providedFirstName.asKnown().isPresent) 1 else 0) +
                            (if (providedLastName.asKnown().isPresent) 1 else 0) +
                            (if (providedMiddleName.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CardholderName &&
                            providedFirstName == other.providedFirstName &&
                            providedLastName == other.providedLastName &&
                            providedMiddleName == other.providedMiddleName &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            providedFirstName,
                            providedLastName,
                            providedMiddleName,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CardholderName{providedFirstName=$providedFirstName, providedLastName=$providedLastName, providedMiddleName=$providedMiddleName, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Verification &&
                        cardVerificationCode == other.cardVerificationCode &&
                        cardholderAddress == other.cardholderAddress &&
                        cardholderName == other.cardholderName &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        cardVerificationCode,
                        cardholderAddress,
                        cardholderName,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, cardholderName=$cardholderName, additionalProperties=$additionalProperties}"
            }

            override fun equals(other: Any?): Boolean {
                if (this === other) {
                    return true
                }

                return other is CardAuthorization &&
                    id == other.id &&
                    actioner == other.actioner &&
                    additionalAmounts == other.additionalAmounts &&
                    amount == other.amount &&
                    cardPaymentId == other.cardPaymentId &&
                    currency == other.currency &&
                    digitalWalletTokenId == other.digitalWalletTokenId &&
                    direction == other.direction &&
                    expiresAt == other.expiresAt &&
                    healthcare == other.healthcare &&
                    merchantAcceptorId == other.merchantAcceptorId &&
                    merchantCategoryCode == other.merchantCategoryCode &&
                    merchantCity == other.merchantCity &&
                    merchantCountry == other.merchantCountry &&
                    merchantDescriptor == other.merchantDescriptor &&
                    merchantPostalCode == other.merchantPostalCode &&
                    merchantState == other.merchantState &&
                    networkDetails == other.networkDetails &&
                    networkIdentifiers == other.networkIdentifiers &&
                    networkRiskScore == other.networkRiskScore &&
                    pendingTransactionId == other.pendingTransactionId &&
                    physicalCardId == other.physicalCardId &&
                    presentmentAmount == other.presentmentAmount &&
                    presentmentCurrency == other.presentmentCurrency &&
                    processingCategory == other.processingCategory &&
                    realTimeDecisionId == other.realTimeDecisionId &&
                    schemeFees == other.schemeFees &&
                    terminalId == other.terminalId &&
                    type == other.type &&
                    verification == other.verification &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    id,
                    actioner,
                    additionalAmounts,
                    amount,
                    cardPaymentId,
                    currency,
                    digitalWalletTokenId,
                    direction,
                    expiresAt,
                    healthcare,
                    merchantAcceptorId,
                    merchantCategoryCode,
                    merchantCity,
                    merchantCountry,
                    merchantDescriptor,
                    merchantPostalCode,
                    merchantState,
                    networkDetails,
                    networkIdentifiers,
                    networkRiskScore,
                    pendingTransactionId,
                    physicalCardId,
                    presentmentAmount,
                    presentmentCurrency,
                    processingCategory,
                    realTimeDecisionId,
                    schemeFees,
                    terminalId,
                    type,
                    verification,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardAuthorization{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, expiresAt=$expiresAt, healthcare=$healthcare, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, pendingTransactionId=$pendingTransactionId, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, realTimeDecisionId=$realTimeDecisionId, schemeFees=$schemeFees, terminalId=$terminalId, type=$type, verification=$verification, additionalProperties=$additionalProperties}"
        }

        /**
         * A Card Authorization Expiration object. This field will be present in the JSON response
         * if and only if `category` is equal to `card_authorization_expiration`. Card Authorization
         * Expirations are cancellations of authorizations that were never settled by the acquirer.
         */
        class CardAuthorizationExpiration
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val id: JsonField<String>,
            private val cardAuthorizationId: JsonField<String>,
            private val currency: JsonField<Currency>,
            private val expiredAmount: JsonField<Long>,
            private val network: JsonField<Network>,
            private val type: JsonField<Type>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
                @JsonProperty("card_authorization_id")
                @ExcludeMissing
                cardAuthorizationId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("expired_amount")
                @ExcludeMissing
                expiredAmount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("network")
                @ExcludeMissing
                network: JsonField<Network> = JsonMissing.of(),
                @JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
            ) : this(
                id,
                cardAuthorizationId,
                currency,
                expiredAmount,
                network,
                type,
                mutableMapOf(),
            )

            /**
             * The Card Authorization Expiration identifier.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun id(): String = id.getRequired("id")

            /**
             * The identifier for the Card Authorization this reverses.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun cardAuthorizationId(): String =
                cardAuthorizationId.getRequired("card_authorization_id")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's
             * currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun currency(): Currency = currency.getRequired("currency")

            /**
             * The amount of this authorization expiration in the minor unit of the transaction's
             * currency. For dollars, for example, this is cents.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun expiredAmount(): Long = expiredAmount.getRequired("expired_amount")

            /**
             * The card network used to process this card authorization.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun network(): Network = network.getRequired("network")

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_authorization_expiration`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun type(): Type = type.getRequired("type")

            /**
             * Returns the raw JSON value of [id].
             *
             * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id

            /**
             * Returns the raw JSON value of [cardAuthorizationId].
             *
             * Unlike [cardAuthorizationId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("card_authorization_id")
            @ExcludeMissing
            fun _cardAuthorizationId(): JsonField<String> = cardAuthorizationId

            /**
             * Returns the raw JSON value of [currency].
             *
             * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("currency")
            @ExcludeMissing
            fun _currency(): JsonField<Currency> = currency

            /**
             * Returns the raw JSON value of [expiredAmount].
             *
             * Unlike [expiredAmount], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("expired_amount")
            @ExcludeMissing
            fun _expiredAmount(): JsonField<Long> = expiredAmount

            /**
             * Returns the raw JSON value of [network].
             *
             * Unlike [network], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("network") @ExcludeMissing fun _network(): JsonField<Network> = network

            /**
             * Returns the raw JSON value of [type].
             *
             * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("type") @ExcludeMissing fun _type(): JsonField<Type> = type

            @JsonAnySetter
            private fun putAdditionalProperty(key: String, value: JsonValue) {
                additionalProperties.put(key, value)
            }

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map<String, JsonValue> =
                Collections.unmodifiableMap(additionalProperties)

            fun toBuilder() = Builder().from(this)

            companion object {

                /**
                 * Returns a mutable builder for constructing an instance of
                 * [CardAuthorizationExpiration].
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .cardAuthorizationId()
                 * .currency()
                 * .expiredAmount()
                 * .network()
                 * .type()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

            /** A builder for [CardAuthorizationExpiration]. */
            class Builder internal constructor() {

                private var id: JsonField<String>? = null
                private var cardAuthorizationId: JsonField<String>? = null
                private var currency: JsonField<Currency>? = null
                private var expiredAmount: JsonField<Long>? = null
                private var network: JsonField<Network>? = null
                private var type: JsonField<Type>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardAuthorizationExpiration: CardAuthorizationExpiration) =
                    apply {
                        id = cardAuthorizationExpiration.id
                        cardAuthorizationId = cardAuthorizationExpiration.cardAuthorizationId
                        currency = cardAuthorizationExpiration.currency
                        expiredAmount = cardAuthorizationExpiration.expiredAmount
                        network = cardAuthorizationExpiration.network
                        type = cardAuthorizationExpiration.type
                        additionalProperties =
                            cardAuthorizationExpiration.additionalProperties.toMutableMap()
                    }

                /** The Card Authorization Expiration identifier. */
                fun id(id: String) = id(JsonField.of(id))

                /**
                 * Sets [Builder.id] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.id] with a well-typed [String] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun id(id: JsonField<String>) = apply { this.id = id }

                /** The identifier for the Card Authorization this reverses. */
                fun cardAuthorizationId(cardAuthorizationId: String) =
                    cardAuthorizationId(JsonField.of(cardAuthorizationId))

                /**
                 * Sets [Builder.cardAuthorizationId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cardAuthorizationId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun cardAuthorizationId(cardAuthorizationId: JsonField<String>) = apply {
                    this.cardAuthorizationId = cardAuthorizationId
                }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's
                 * currency.
                 */
                fun currency(currency: Currency) = currency(JsonField.of(currency))

                /**
                 * Sets [Builder.currency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.currency] with a well-typed [Currency] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                /**
                 * The amount of this authorization expiration in the minor unit of the
                 * transaction's currency. For dollars, for example, this is cents.
                 */
                fun expiredAmount(expiredAmount: Long) = expiredAmount(JsonField.of(expiredAmount))

                /**
                 * Sets [Builder.expiredAmount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.expiredAmount] with a well-typed [Long] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun expiredAmount(expiredAmount: JsonField<Long>) = apply {
                    this.expiredAmount = expiredAmount
                }

                /** The card network used to process this card authorization. */
                fun network(network: Network) = network(JsonField.of(network))

                /**
                 * Sets [Builder.network] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.network] with a well-typed [Network] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun network(network: JsonField<Network>) = apply { this.network = network }

                /**
                 * A constant representing the object's type. For this resource it will always be
                 * `card_authorization_expiration`.
                 */
                fun type(type: Type) = type(JsonField.of(type))

                /**
                 * Sets [Builder.type] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.type] with a well-typed [Type] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun type(type: JsonField<Type>) = apply { this.type = type }

                fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                    this.additionalProperties.clear()
                    putAllAdditionalProperties(additionalProperties)
                }

                fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                    additionalProperties.put(key, value)
                }

                fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun removeAdditionalProperty(key: String) = apply {
                    additionalProperties.remove(key)
                }

                fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                    keys.forEach(::removeAdditionalProperty)
                }

                /**
                 * Returns an immutable instance of [CardAuthorizationExpiration].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .cardAuthorizationId()
                 * .currency()
                 * .expiredAmount()
                 * .network()
                 * .type()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardAuthorizationExpiration =
                    CardAuthorizationExpiration(
                        checkRequired("id", id),
                        checkRequired("cardAuthorizationId", cardAuthorizationId),
                        checkRequired("currency", currency),
                        checkRequired("expiredAmount", expiredAmount),
                        checkRequired("network", network),
                        checkRequired("type", type),
                        additionalProperties.toMutableMap(),
                    )
            }

            private var validated: Boolean = false

            /**
             * Validates that the types of all values in this object match their expected types
             * recursively.
             *
             * This method is _not_ forwards compatible with new types from the API for existing
             * fields.
             *
             * @throws IncreaseInvalidDataException if any value type in this object doesn't match
             *   its expected type.
             */
            fun validate(): CardAuthorizationExpiration = apply {
                if (validated) {
                    return@apply
                }

                id()
                cardAuthorizationId()
                currency().validate()
                expiredAmount()
                network().validate()
                type().validate()
                validated = true
            }

            fun isValid(): Boolean =
                try {
                    validate()
                    true
                } catch (e: IncreaseInvalidDataException) {
                    false
                }

            /**
             * Returns a score indicating how many valid values are contained in this object
             * recursively.
             *
             * Used for best match union deserialization.
             */
            @JvmSynthetic
            internal fun validity(): Int =
                (if (id.asKnown().isPresent) 1 else 0) +
                    (if (cardAuthorizationId.asKnown().isPresent) 1 else 0) +
                    (currency.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (expiredAmount.asKnown().isPresent) 1 else 0) +
                    (network.asKnown().getOrNull()?.validity() ?: 0) +
                    (type.asKnown().getOrNull()?.validity() ?: 0)

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's
             * currency.
             */
            class Currency @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** US Dollar (USD) */
                    @JvmField val USD = of("USD")

                    @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                }

                /** An enum containing [Currency]'s known values. */
                enum class Known {
                    /** US Dollar (USD) */
                    USD
                }

                /**
                 * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Currency] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** US Dollar (USD) */
                    USD,
                    /**
                     * An enum member indicating that [Currency] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        USD -> Value.USD
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        USD -> Known.USD
                        else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Currency = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Currency && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** The card network used to process this card authorization. */
            class Network @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** Visa */
                    @JvmField val VISA = of("visa")

                    /** Pulse */
                    @JvmField val PULSE = of("pulse")

                    @JvmStatic fun of(value: String) = Network(JsonField.of(value))
                }

                /** An enum containing [Network]'s known values. */
                enum class Known {
                    /** Visa */
                    VISA,
                    /** Pulse */
                    PULSE,
                }

                /**
                 * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Network] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** Visa */
                    VISA,
                    /** Pulse */
                    PULSE,
                    /**
                     * An enum member indicating that [Network] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        VISA -> Value.VISA
                        PULSE -> Value.PULSE
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        VISA -> Known.VISA
                        PULSE -> Known.PULSE
                        else -> throw IncreaseInvalidDataException("Unknown Network: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Network = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Network && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_authorization_expiration`.
             */
            class Type @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    @JvmField
                    val CARD_AUTHORIZATION_EXPIRATION = of("card_authorization_expiration")

                    @JvmStatic fun of(value: String) = Type(JsonField.of(value))
                }

                /** An enum containing [Type]'s known values. */
                enum class Known {
                    CARD_AUTHORIZATION_EXPIRATION
                }

                /**
                 * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Type] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    CARD_AUTHORIZATION_EXPIRATION,
                    /**
                     * An enum member indicating that [Type] was instantiated with an unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        CARD_AUTHORIZATION_EXPIRATION -> Value.CARD_AUTHORIZATION_EXPIRATION
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        CARD_AUTHORIZATION_EXPIRATION -> Known.CARD_AUTHORIZATION_EXPIRATION
                        else -> throw IncreaseInvalidDataException("Unknown Type: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Type = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Type && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            override fun equals(other: Any?): Boolean {
                if (this === other) {
                    return true
                }

                return other is CardAuthorizationExpiration &&
                    id == other.id &&
                    cardAuthorizationId == other.cardAuthorizationId &&
                    currency == other.currency &&
                    expiredAmount == other.expiredAmount &&
                    network == other.network &&
                    type == other.type &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    id,
                    cardAuthorizationId,
                    currency,
                    expiredAmount,
                    network,
                    type,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardAuthorizationExpiration{id=$id, cardAuthorizationId=$cardAuthorizationId, currency=$currency, expiredAmount=$expiredAmount, network=$network, type=$type, additionalProperties=$additionalProperties}"
        }

        /**
         * A Card Balance Inquiry object. This field will be present in the JSON response if and
         * only if `category` is equal to `card_balance_inquiry`. Card Balance Inquiries are
         * transactions that allow merchants to check the available balance on a card without
         * placing a hold on funds, commonly used when a customer requests their balance at an ATM.
         */
        class CardBalanceInquiry
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val id: JsonField<String>,
            private val additionalAmounts: JsonField<AdditionalAmounts>,
            private val balance: JsonField<Long>,
            private val cardPaymentId: JsonField<String>,
            private val currency: JsonField<Currency>,
            private val digitalWalletTokenId: JsonField<String>,
            private val merchantAcceptorId: JsonField<String>,
            private val merchantCategoryCode: JsonField<String>,
            private val merchantCity: JsonField<String>,
            private val merchantCountry: JsonField<String>,
            private val merchantDescriptor: JsonField<String>,
            private val merchantPostalCode: JsonField<String>,
            private val merchantState: JsonField<String>,
            private val networkDetails: JsonField<NetworkDetails>,
            private val networkIdentifiers: JsonField<NetworkIdentifiers>,
            private val networkRiskScore: JsonField<Long>,
            private val physicalCardId: JsonField<String>,
            private val realTimeDecisionId: JsonField<String>,
            private val schemeFees: JsonField<List<SchemeFee>>,
            private val terminalId: JsonField<String>,
            private val type: JsonField<Type>,
            private val verification: JsonField<Verification>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
                @JsonProperty("additional_amounts")
                @ExcludeMissing
                additionalAmounts: JsonField<AdditionalAmounts> = JsonMissing.of(),
                @JsonProperty("balance")
                @ExcludeMissing
                balance: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("card_payment_id")
                @ExcludeMissing
                cardPaymentId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("digital_wallet_token_id")
                @ExcludeMissing
                digitalWalletTokenId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_acceptor_id")
                @ExcludeMissing
                merchantAcceptorId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_category_code")
                @ExcludeMissing
                merchantCategoryCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_city")
                @ExcludeMissing
                merchantCity: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_country")
                @ExcludeMissing
                merchantCountry: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_descriptor")
                @ExcludeMissing
                merchantDescriptor: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_postal_code")
                @ExcludeMissing
                merchantPostalCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_state")
                @ExcludeMissing
                merchantState: JsonField<String> = JsonMissing.of(),
                @JsonProperty("network_details")
                @ExcludeMissing
                networkDetails: JsonField<NetworkDetails> = JsonMissing.of(),
                @JsonProperty("network_identifiers")
                @ExcludeMissing
                networkIdentifiers: JsonField<NetworkIdentifiers> = JsonMissing.of(),
                @JsonProperty("network_risk_score")
                @ExcludeMissing
                networkRiskScore: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("physical_card_id")
                @ExcludeMissing
                physicalCardId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("real_time_decision_id")
                @ExcludeMissing
                realTimeDecisionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("scheme_fees")
                @ExcludeMissing
                schemeFees: JsonField<List<SchemeFee>> = JsonMissing.of(),
                @JsonProperty("terminal_id")
                @ExcludeMissing
                terminalId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
                @JsonProperty("verification")
                @ExcludeMissing
                verification: JsonField<Verification> = JsonMissing.of(),
            ) : this(
                id,
                additionalAmounts,
                balance,
                cardPaymentId,
                currency,
                digitalWalletTokenId,
                merchantAcceptorId,
                merchantCategoryCode,
                merchantCity,
                merchantCountry,
                merchantDescriptor,
                merchantPostalCode,
                merchantState,
                networkDetails,
                networkIdentifiers,
                networkRiskScore,
                physicalCardId,
                realTimeDecisionId,
                schemeFees,
                terminalId,
                type,
                verification,
                mutableMapOf(),
            )

            /**
             * The Card Balance Inquiry identifier.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun id(): String = id.getRequired("id")

            /**
             * Additional amounts associated with the card authorization, such as ATM surcharges
             * fees. These are usually a subset of the `amount` field and are used to provide more
             * detailed information about the transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun additionalAmounts(): AdditionalAmounts =
                additionalAmounts.getRequired("additional_amounts")

            /**
             * The balance amount in the minor unit of the account's currency. For dollars, for
             * example, this is cents.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun balance(): Long = balance.getRequired("balance")

            /**
             * The ID of the Card Payment this transaction belongs to.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun cardPaymentId(): String = cardPaymentId.getRequired("card_payment_id")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the account's
             * currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun currency(): Currency = currency.getRequired("currency")

            /**
             * If the authorization was made via a Digital Wallet Token (such as an Apple Pay
             * purchase), the identifier of the token that was used.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun digitalWalletTokenId(): Optional<String> =
                digitalWalletTokenId.getOptional("digital_wallet_token_id")

            /**
             * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantAcceptorId(): String =
                merchantAcceptorId.getRequired("merchant_acceptor_id")

            /**
             * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCategoryCode(): String =
                merchantCategoryCode.getRequired("merchant_category_code")

            /**
             * The city the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantCity(): Optional<String> = merchantCity.getOptional("merchant_city")

            /**
             * The country the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCountry(): String = merchantCountry.getRequired("merchant_country")

            /**
             * The merchant descriptor of the merchant the card is transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantDescriptor(): String = merchantDescriptor.getRequired("merchant_descriptor")

            /**
             * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit ZIP
             * code, where the first 5 and last 4 are separated by a dash.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantPostalCode(): Optional<String> =
                merchantPostalCode.getOptional("merchant_postal_code")

            /**
             * The state the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantState(): Optional<String> = merchantState.getOptional("merchant_state")

            /**
             * Fields specific to the `network`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details")

            /**
             * Network-specific identifiers for a specific request or transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun networkIdentifiers(): NetworkIdentifiers =
                networkIdentifiers.getRequired("network_identifiers")

            /**
             * The risk score generated by the card network. For Visa this is the Visa Advanced
             * Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the score
             * is from 0 to 999, where 999 is the riskiest.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun networkRiskScore(): Optional<Long> =
                networkRiskScore.getOptional("network_risk_score")

            /**
             * If the authorization was made in-person with a physical card, the Physical Card that
             * was used.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun physicalCardId(): Optional<String> = physicalCardId.getOptional("physical_card_id")

            /**
             * The identifier of the Real-Time Decision sent to approve or decline this transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun realTimeDecisionId(): Optional<String> =
                realTimeDecisionId.getOptional("real_time_decision_id")

            /**
             * The scheme fees associated with this card balance inquiry.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun schemeFees(): List<SchemeFee> = schemeFees.getRequired("scheme_fees")

            /**
             * The terminal identifier (commonly abbreviated as TID) of the terminal the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun terminalId(): Optional<String> = terminalId.getOptional("terminal_id")

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_balance_inquiry`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun type(): Type = type.getRequired("type")

            /**
             * Fields related to verification of cardholder-provided values.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun verification(): Verification = verification.getRequired("verification")

            /**
             * Returns the raw JSON value of [id].
             *
             * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id

            /**
             * Returns the raw JSON value of [additionalAmounts].
             *
             * Unlike [additionalAmounts], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("additional_amounts")
            @ExcludeMissing
            fun _additionalAmounts(): JsonField<AdditionalAmounts> = additionalAmounts

            /**
             * Returns the raw JSON value of [balance].
             *
             * Unlike [balance], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("balance") @ExcludeMissing fun _balance(): JsonField<Long> = balance

            /**
             * Returns the raw JSON value of [cardPaymentId].
             *
             * Unlike [cardPaymentId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("card_payment_id")
            @ExcludeMissing
            fun _cardPaymentId(): JsonField<String> = cardPaymentId

            /**
             * Returns the raw JSON value of [currency].
             *
             * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("currency")
            @ExcludeMissing
            fun _currency(): JsonField<Currency> = currency

            /**
             * Returns the raw JSON value of [digitalWalletTokenId].
             *
             * Unlike [digitalWalletTokenId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("digital_wallet_token_id")
            @ExcludeMissing
            fun _digitalWalletTokenId(): JsonField<String> = digitalWalletTokenId

            /**
             * Returns the raw JSON value of [merchantAcceptorId].
             *
             * Unlike [merchantAcceptorId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_acceptor_id")
            @ExcludeMissing
            fun _merchantAcceptorId(): JsonField<String> = merchantAcceptorId

            /**
             * Returns the raw JSON value of [merchantCategoryCode].
             *
             * Unlike [merchantCategoryCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_category_code")
            @ExcludeMissing
            fun _merchantCategoryCode(): JsonField<String> = merchantCategoryCode

            /**
             * Returns the raw JSON value of [merchantCity].
             *
             * Unlike [merchantCity], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_city")
            @ExcludeMissing
            fun _merchantCity(): JsonField<String> = merchantCity

            /**
             * Returns the raw JSON value of [merchantCountry].
             *
             * Unlike [merchantCountry], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_country")
            @ExcludeMissing
            fun _merchantCountry(): JsonField<String> = merchantCountry

            /**
             * Returns the raw JSON value of [merchantDescriptor].
             *
             * Unlike [merchantDescriptor], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_descriptor")
            @ExcludeMissing
            fun _merchantDescriptor(): JsonField<String> = merchantDescriptor

            /**
             * Returns the raw JSON value of [merchantPostalCode].
             *
             * Unlike [merchantPostalCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_postal_code")
            @ExcludeMissing
            fun _merchantPostalCode(): JsonField<String> = merchantPostalCode

            /**
             * Returns the raw JSON value of [merchantState].
             *
             * Unlike [merchantState], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_state")
            @ExcludeMissing
            fun _merchantState(): JsonField<String> = merchantState

            /**
             * Returns the raw JSON value of [networkDetails].
             *
             * Unlike [networkDetails], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_details")
            @ExcludeMissing
            fun _networkDetails(): JsonField<NetworkDetails> = networkDetails

            /**
             * Returns the raw JSON value of [networkIdentifiers].
             *
             * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_identifiers")
            @ExcludeMissing
            fun _networkIdentifiers(): JsonField<NetworkIdentifiers> = networkIdentifiers

            /**
             * Returns the raw JSON value of [networkRiskScore].
             *
             * Unlike [networkRiskScore], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_risk_score")
            @ExcludeMissing
            fun _networkRiskScore(): JsonField<Long> = networkRiskScore

            /**
             * Returns the raw JSON value of [physicalCardId].
             *
             * Unlike [physicalCardId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("physical_card_id")
            @ExcludeMissing
            fun _physicalCardId(): JsonField<String> = physicalCardId

            /**
             * Returns the raw JSON value of [realTimeDecisionId].
             *
             * Unlike [realTimeDecisionId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("real_time_decision_id")
            @ExcludeMissing
            fun _realTimeDecisionId(): JsonField<String> = realTimeDecisionId

            /**
             * Returns the raw JSON value of [schemeFees].
             *
             * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("scheme_fees")
            @ExcludeMissing
            fun _schemeFees(): JsonField<List<SchemeFee>> = schemeFees

            /**
             * Returns the raw JSON value of [terminalId].
             *
             * Unlike [terminalId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("terminal_id")
            @ExcludeMissing
            fun _terminalId(): JsonField<String> = terminalId

            /**
             * Returns the raw JSON value of [type].
             *
             * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("type") @ExcludeMissing fun _type(): JsonField<Type> = type

            /**
             * Returns the raw JSON value of [verification].
             *
             * Unlike [verification], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("verification")
            @ExcludeMissing
            fun _verification(): JsonField<Verification> = verification

            @JsonAnySetter
            private fun putAdditionalProperty(key: String, value: JsonValue) {
                additionalProperties.put(key, value)
            }

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map<String, JsonValue> =
                Collections.unmodifiableMap(additionalProperties)

            fun toBuilder() = Builder().from(this)

            companion object {

                /**
                 * Returns a mutable builder for constructing an instance of [CardBalanceInquiry].
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .additionalAmounts()
                 * .balance()
                 * .cardPaymentId()
                 * .currency()
                 * .digitalWalletTokenId()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCity()
                 * .merchantCountry()
                 * .merchantDescriptor()
                 * .merchantPostalCode()
                 * .merchantState()
                 * .networkDetails()
                 * .networkIdentifiers()
                 * .networkRiskScore()
                 * .physicalCardId()
                 * .realTimeDecisionId()
                 * .schemeFees()
                 * .terminalId()
                 * .type()
                 * .verification()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

            /** A builder for [CardBalanceInquiry]. */
            class Builder internal constructor() {

                private var id: JsonField<String>? = null
                private var additionalAmounts: JsonField<AdditionalAmounts>? = null
                private var balance: JsonField<Long>? = null
                private var cardPaymentId: JsonField<String>? = null
                private var currency: JsonField<Currency>? = null
                private var digitalWalletTokenId: JsonField<String>? = null
                private var merchantAcceptorId: JsonField<String>? = null
                private var merchantCategoryCode: JsonField<String>? = null
                private var merchantCity: JsonField<String>? = null
                private var merchantCountry: JsonField<String>? = null
                private var merchantDescriptor: JsonField<String>? = null
                private var merchantPostalCode: JsonField<String>? = null
                private var merchantState: JsonField<String>? = null
                private var networkDetails: JsonField<NetworkDetails>? = null
                private var networkIdentifiers: JsonField<NetworkIdentifiers>? = null
                private var networkRiskScore: JsonField<Long>? = null
                private var physicalCardId: JsonField<String>? = null
                private var realTimeDecisionId: JsonField<String>? = null
                private var schemeFees: JsonField<MutableList<SchemeFee>>? = null
                private var terminalId: JsonField<String>? = null
                private var type: JsonField<Type>? = null
                private var verification: JsonField<Verification>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardBalanceInquiry: CardBalanceInquiry) = apply {
                    id = cardBalanceInquiry.id
                    additionalAmounts = cardBalanceInquiry.additionalAmounts
                    balance = cardBalanceInquiry.balance
                    cardPaymentId = cardBalanceInquiry.cardPaymentId
                    currency = cardBalanceInquiry.currency
                    digitalWalletTokenId = cardBalanceInquiry.digitalWalletTokenId
                    merchantAcceptorId = cardBalanceInquiry.merchantAcceptorId
                    merchantCategoryCode = cardBalanceInquiry.merchantCategoryCode
                    merchantCity = cardBalanceInquiry.merchantCity
                    merchantCountry = cardBalanceInquiry.merchantCountry
                    merchantDescriptor = cardBalanceInquiry.merchantDescriptor
                    merchantPostalCode = cardBalanceInquiry.merchantPostalCode
                    merchantState = cardBalanceInquiry.merchantState
                    networkDetails = cardBalanceInquiry.networkDetails
                    networkIdentifiers = cardBalanceInquiry.networkIdentifiers
                    networkRiskScore = cardBalanceInquiry.networkRiskScore
                    physicalCardId = cardBalanceInquiry.physicalCardId
                    realTimeDecisionId = cardBalanceInquiry.realTimeDecisionId
                    schemeFees = cardBalanceInquiry.schemeFees.map { it.toMutableList() }
                    terminalId = cardBalanceInquiry.terminalId
                    type = cardBalanceInquiry.type
                    verification = cardBalanceInquiry.verification
                    additionalProperties = cardBalanceInquiry.additionalProperties.toMutableMap()
                }

                /** The Card Balance Inquiry identifier. */
                fun id(id: String) = id(JsonField.of(id))

                /**
                 * Sets [Builder.id] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.id] with a well-typed [String] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun id(id: JsonField<String>) = apply { this.id = id }

                /**
                 * Additional amounts associated with the card authorization, such as ATM surcharges
                 * fees. These are usually a subset of the `amount` field and are used to provide
                 * more detailed information about the transaction.
                 */
                fun additionalAmounts(additionalAmounts: AdditionalAmounts) =
                    additionalAmounts(JsonField.of(additionalAmounts))

                /**
                 * Sets [Builder.additionalAmounts] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.additionalAmounts] with a well-typed
                 * [AdditionalAmounts] value instead. This method is primarily for setting the field
                 * to an undocumented or not yet supported value.
                 */
                fun additionalAmounts(additionalAmounts: JsonField<AdditionalAmounts>) = apply {
                    this.additionalAmounts = additionalAmounts
                }

                /**
                 * The balance amount in the minor unit of the account's currency. For dollars, for
                 * example, this is cents.
                 */
                fun balance(balance: Long) = balance(JsonField.of(balance))

                /**
                 * Sets [Builder.balance] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.balance] with a well-typed [Long] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun balance(balance: JsonField<Long>) = apply { this.balance = balance }

                /** The ID of the Card Payment this transaction belongs to. */
                fun cardPaymentId(cardPaymentId: String) =
                    cardPaymentId(JsonField.of(cardPaymentId))

                /**
                 * Sets [Builder.cardPaymentId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cardPaymentId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun cardPaymentId(cardPaymentId: JsonField<String>) = apply {
                    this.cardPaymentId = cardPaymentId
                }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the account's
                 * currency.
                 */
                fun currency(currency: Currency) = currency(JsonField.of(currency))

                /**
                 * Sets [Builder.currency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.currency] with a well-typed [Currency] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                /**
                 * If the authorization was made via a Digital Wallet Token (such as an Apple Pay
                 * purchase), the identifier of the token that was used.
                 */
                fun digitalWalletTokenId(digitalWalletTokenId: String?) =
                    digitalWalletTokenId(JsonField.ofNullable(digitalWalletTokenId))

                /**
                 * Alias for calling [Builder.digitalWalletTokenId] with
                 * `digitalWalletTokenId.orElse(null)`.
                 */
                fun digitalWalletTokenId(digitalWalletTokenId: Optional<String>) =
                    digitalWalletTokenId(digitalWalletTokenId.getOrNull())

                /**
                 * Sets [Builder.digitalWalletTokenId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.digitalWalletTokenId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun digitalWalletTokenId(digitalWalletTokenId: JsonField<String>) = apply {
                    this.digitalWalletTokenId = digitalWalletTokenId
                }

                /**
                 * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
                 * transacting with.
                 */
                fun merchantAcceptorId(merchantAcceptorId: String) =
                    merchantAcceptorId(JsonField.of(merchantAcceptorId))

                /**
                 * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantAcceptorId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantAcceptorId(merchantAcceptorId: JsonField<String>) = apply {
                    this.merchantAcceptorId = merchantAcceptorId
                }

                /**
                 * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card
                 * is transacting with.
                 */
                fun merchantCategoryCode(merchantCategoryCode: String) =
                    merchantCategoryCode(JsonField.of(merchantCategoryCode))

                /**
                 * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCategoryCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCategoryCode(merchantCategoryCode: JsonField<String>) = apply {
                    this.merchantCategoryCode = merchantCategoryCode
                }

                /** The city the merchant resides in. */
                fun merchantCity(merchantCity: String?) =
                    merchantCity(JsonField.ofNullable(merchantCity))

                /** Alias for calling [Builder.merchantCity] with `merchantCity.orElse(null)`. */
                fun merchantCity(merchantCity: Optional<String>) =
                    merchantCity(merchantCity.getOrNull())

                /**
                 * Sets [Builder.merchantCity] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCity] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantCity(merchantCity: JsonField<String>) = apply {
                    this.merchantCity = merchantCity
                }

                /** The country the merchant resides in. */
                fun merchantCountry(merchantCountry: String) =
                    merchantCountry(JsonField.of(merchantCountry))

                /**
                 * Sets [Builder.merchantCountry] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCountry] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCountry(merchantCountry: JsonField<String>) = apply {
                    this.merchantCountry = merchantCountry
                }

                /** The merchant descriptor of the merchant the card is transacting with. */
                fun merchantDescriptor(merchantDescriptor: String) =
                    merchantDescriptor(JsonField.of(merchantDescriptor))

                /**
                 * Sets [Builder.merchantDescriptor] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantDescriptor] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantDescriptor(merchantDescriptor: JsonField<String>) = apply {
                    this.merchantDescriptor = merchantDescriptor
                }

                /**
                 * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit
                 * ZIP code, where the first 5 and last 4 are separated by a dash.
                 */
                fun merchantPostalCode(merchantPostalCode: String?) =
                    merchantPostalCode(JsonField.ofNullable(merchantPostalCode))

                /**
                 * Alias for calling [Builder.merchantPostalCode] with
                 * `merchantPostalCode.orElse(null)`.
                 */
                fun merchantPostalCode(merchantPostalCode: Optional<String>) =
                    merchantPostalCode(merchantPostalCode.getOrNull())

                /**
                 * Sets [Builder.merchantPostalCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantPostalCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantPostalCode(merchantPostalCode: JsonField<String>) = apply {
                    this.merchantPostalCode = merchantPostalCode
                }

                /** The state the merchant resides in. */
                fun merchantState(merchantState: String?) =
                    merchantState(JsonField.ofNullable(merchantState))

                /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */
                fun merchantState(merchantState: Optional<String>) =
                    merchantState(merchantState.getOrNull())

                /**
                 * Sets [Builder.merchantState] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantState] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantState(merchantState: JsonField<String>) = apply {
                    this.merchantState = merchantState
                }

                /** Fields specific to the `network`. */
                fun networkDetails(networkDetails: NetworkDetails) =
                    networkDetails(JsonField.of(networkDetails))

                /**
                 * Sets [Builder.networkDetails] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkDetails] with a well-typed
                 * [NetworkDetails] value instead. This method is primarily for setting the field to
                 * an undocumented or not yet supported value.
                 */
                fun networkDetails(networkDetails: JsonField<NetworkDetails>) = apply {
                    this.networkDetails = networkDetails
                }

                /** Network-specific identifiers for a specific request or transaction. */
                fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) =
                    networkIdentifiers(JsonField.of(networkIdentifiers))

                /**
                 * Sets [Builder.networkIdentifiers] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkIdentifiers] with a well-typed
                 * [NetworkIdentifiers] value instead. This method is primarily for setting the
                 * field to an undocumented or not yet supported value.
                 */
                fun networkIdentifiers(networkIdentifiers: JsonField<NetworkIdentifiers>) = apply {
                    this.networkIdentifiers = networkIdentifiers
                }

                /**
                 * The risk score generated by the card network. For Visa this is the Visa Advanced
                 * Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the
                 * score is from 0 to 999, where 999 is the riskiest.
                 */
                fun networkRiskScore(networkRiskScore: Long?) =
                    networkRiskScore(JsonField.ofNullable(networkRiskScore))

                /**
                 * Alias for [Builder.networkRiskScore].
                 *
                 * This unboxed primitive overload exists for backwards compatibility.
                 */
                fun networkRiskScore(networkRiskScore: Long) =
                    networkRiskScore(networkRiskScore as Long?)

                /**
                 * Alias for calling [Builder.networkRiskScore] with
                 * `networkRiskScore.orElse(null)`.
                 */
                fun networkRiskScore(networkRiskScore: Optional<Long>) =
                    networkRiskScore(networkRiskScore.getOrNull())

                /**
                 * Sets [Builder.networkRiskScore] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkRiskScore] with a well-typed [Long] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun networkRiskScore(networkRiskScore: JsonField<Long>) = apply {
                    this.networkRiskScore = networkRiskScore
                }

                /**
                 * If the authorization was made in-person with a physical card, the Physical Card
                 * that was used.
                 */
                fun physicalCardId(physicalCardId: String?) =
                    physicalCardId(JsonField.ofNullable(physicalCardId))

                /**
                 * Alias for calling [Builder.physicalCardId] with `physicalCardId.orElse(null)`.
                 */
                fun physicalCardId(physicalCardId: Optional<String>) =
                    physicalCardId(physicalCardId.getOrNull())

                /**
                 * Sets [Builder.physicalCardId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.physicalCardId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun physicalCardId(physicalCardId: JsonField<String>) = apply {
                    this.physicalCardId = physicalCardId
                }

                /**
                 * The identifier of the Real-Time Decision sent to approve or decline this
                 * transaction.
                 */
                fun realTimeDecisionId(realTimeDecisionId: String?) =
                    realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId))

                /**
                 * Alias for calling [Builder.realTimeDecisionId] with
                 * `realTimeDecisionId.orElse(null)`.
                 */
                fun realTimeDecisionId(realTimeDecisionId: Optional<String>) =
                    realTimeDecisionId(realTimeDecisionId.getOrNull())

                /**
                 * Sets [Builder.realTimeDecisionId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.realTimeDecisionId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun realTimeDecisionId(realTimeDecisionId: JsonField<String>) = apply {
                    this.realTimeDecisionId = realTimeDecisionId
                }

                /** The scheme fees associated with this card balance inquiry. */
                fun schemeFees(schemeFees: List<SchemeFee>) = schemeFees(JsonField.of(schemeFees))

                /**
                 * Sets [Builder.schemeFees] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.schemeFees] with a well-typed `List<SchemeFee>`
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun schemeFees(schemeFees: JsonField<List<SchemeFee>>) = apply {
                    this.schemeFees = schemeFees.map { it.toMutableList() }
                }

                /**
                 * Adds a single [SchemeFee] to [schemeFees].
                 *
                 * @throws IllegalStateException if the field was previously set to a non-list.
                 */
                fun addSchemeFee(schemeFee: SchemeFee) = apply {
                    schemeFees =
                        (schemeFees ?: JsonField.of(mutableListOf())).also {
                            checkKnown("schemeFees", it).add(schemeFee)
                        }
                }

                /**
                 * The terminal identifier (commonly abbreviated as TID) of the terminal the card is
                 * transacting with.
                 */
                fun terminalId(terminalId: String?) = terminalId(JsonField.ofNullable(terminalId))

                /** Alias for calling [Builder.terminalId] with `terminalId.orElse(null)`. */
                fun terminalId(terminalId: Optional<String>) = terminalId(terminalId.getOrNull())

                /**
                 * Sets [Builder.terminalId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.terminalId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun terminalId(terminalId: JsonField<String>) = apply {
                    this.terminalId = terminalId
                }

                /**
                 * A constant representing the object's type. For this resource it will always be
                 * `card_balance_inquiry`.
                 */
                fun type(type: Type) = type(JsonField.of(type))

                /**
                 * Sets [Builder.type] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.type] with a well-typed [Type] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun type(type: JsonField<Type>) = apply { this.type = type }

                /** Fields related to verification of cardholder-provided values. */
                fun verification(verification: Verification) =
                    verification(JsonField.of(verification))

                /**
                 * Sets [Builder.verification] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.verification] with a well-typed [Verification]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun verification(verification: JsonField<Verification>) = apply {
                    this.verification = verification
                }

                fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                    this.additionalProperties.clear()
                    putAllAdditionalProperties(additionalProperties)
                }

                fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                    additionalProperties.put(key, value)
                }

                fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun removeAdditionalProperty(key: String) = apply {
                    additionalProperties.remove(key)
                }

                fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                    keys.forEach(::removeAdditionalProperty)
                }

                /**
                 * Returns an immutable instance of [CardBalanceInquiry].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .additionalAmounts()
                 * .balance()
                 * .cardPaymentId()
                 * .currency()
                 * .digitalWalletTokenId()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCity()
                 * .merchantCountry()
                 * .merchantDescriptor()
                 * .merchantPostalCode()
                 * .merchantState()
                 * .networkDetails()
                 * .networkIdentifiers()
                 * .networkRiskScore()
                 * .physicalCardId()
                 * .realTimeDecisionId()
                 * .schemeFees()
                 * .terminalId()
                 * .type()
                 * .verification()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardBalanceInquiry =
                    CardBalanceInquiry(
                        checkRequired("id", id),
                        checkRequired("additionalAmounts", additionalAmounts),
                        checkRequired("balance", balance),
                        checkRequired("cardPaymentId", cardPaymentId),
                        checkRequired("currency", currency),
                        checkRequired("digitalWalletTokenId", digitalWalletTokenId),
                        checkRequired("merchantAcceptorId", merchantAcceptorId),
                        checkRequired("merchantCategoryCode", merchantCategoryCode),
                        checkRequired("merchantCity", merchantCity),
                        checkRequired("merchantCountry", merchantCountry),
                        checkRequired("merchantDescriptor", merchantDescriptor),
                        checkRequired("merchantPostalCode", merchantPostalCode),
                        checkRequired("merchantState", merchantState),
                        checkRequired("networkDetails", networkDetails),
                        checkRequired("networkIdentifiers", networkIdentifiers),
                        checkRequired("networkRiskScore", networkRiskScore),
                        checkRequired("physicalCardId", physicalCardId),
                        checkRequired("realTimeDecisionId", realTimeDecisionId),
                        checkRequired("schemeFees", schemeFees).map { it.toImmutable() },
                        checkRequired("terminalId", terminalId),
                        checkRequired("type", type),
                        checkRequired("verification", verification),
                        additionalProperties.toMutableMap(),
                    )
            }

            private var validated: Boolean = false

            /**
             * Validates that the types of all values in this object match their expected types
             * recursively.
             *
             * This method is _not_ forwards compatible with new types from the API for existing
             * fields.
             *
             * @throws IncreaseInvalidDataException if any value type in this object doesn't match
             *   its expected type.
             */
            fun validate(): CardBalanceInquiry = apply {
                if (validated) {
                    return@apply
                }

                id()
                additionalAmounts().validate()
                balance()
                cardPaymentId()
                currency().validate()
                digitalWalletTokenId()
                merchantAcceptorId()
                merchantCategoryCode()
                merchantCity()
                merchantCountry()
                merchantDescriptor()
                merchantPostalCode()
                merchantState()
                networkDetails().validate()
                networkIdentifiers().validate()
                networkRiskScore()
                physicalCardId()
                realTimeDecisionId()
                schemeFees().forEach { it.validate() }
                terminalId()
                type().validate()
                verification().validate()
                validated = true
            }

            fun isValid(): Boolean =
                try {
                    validate()
                    true
                } catch (e: IncreaseInvalidDataException) {
                    false
                }

            /**
             * Returns a score indicating how many valid values are contained in this object
             * recursively.
             *
             * Used for best match union deserialization.
             */
            @JvmSynthetic
            internal fun validity(): Int =
                (if (id.asKnown().isPresent) 1 else 0) +
                    (additionalAmounts.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (balance.asKnown().isPresent) 1 else 0) +
                    (if (cardPaymentId.asKnown().isPresent) 1 else 0) +
                    (currency.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (digitalWalletTokenId.asKnown().isPresent) 1 else 0) +
                    (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) +
                    (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantCity.asKnown().isPresent) 1 else 0) +
                    (if (merchantCountry.asKnown().isPresent) 1 else 0) +
                    (if (merchantDescriptor.asKnown().isPresent) 1 else 0) +
                    (if (merchantPostalCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantState.asKnown().isPresent) 1 else 0) +
                    (networkDetails.asKnown().getOrNull()?.validity() ?: 0) +
                    (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (networkRiskScore.asKnown().isPresent) 1 else 0) +
                    (if (physicalCardId.asKnown().isPresent) 1 else 0) +
                    (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) +
                    (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
                    (if (terminalId.asKnown().isPresent) 1 else 0) +
                    (type.asKnown().getOrNull()?.validity() ?: 0) +
                    (verification.asKnown().getOrNull()?.validity() ?: 0)

            /**
             * Additional amounts associated with the card authorization, such as ATM surcharges
             * fees. These are usually a subset of the `amount` field and are used to provide more
             * detailed information about the transaction.
             */
            class AdditionalAmounts
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val clinic: JsonField<Clinic>,
                private val dental: JsonField<Dental>,
                private val original: JsonField<Original>,
                private val prescription: JsonField<Prescription>,
                private val surcharge: JsonField<Surcharge>,
                private val totalCumulative: JsonField<TotalCumulative>,
                private val totalHealthcare: JsonField<TotalHealthcare>,
                private val transit: JsonField<Transit>,
                private val unknown: JsonField<Unknown>,
                private val vision: JsonField<Vision>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("clinic")
                    @ExcludeMissing
                    clinic: JsonField<Clinic> = JsonMissing.of(),
                    @JsonProperty("dental")
                    @ExcludeMissing
                    dental: JsonField<Dental> = JsonMissing.of(),
                    @JsonProperty("original")
                    @ExcludeMissing
                    original: JsonField<Original> = JsonMissing.of(),
                    @JsonProperty("prescription")
                    @ExcludeMissing
                    prescription: JsonField<Prescription> = JsonMissing.of(),
                    @JsonProperty("surcharge")
                    @ExcludeMissing
                    surcharge: JsonField<Surcharge> = JsonMissing.of(),
                    @JsonProperty("total_cumulative")
                    @ExcludeMissing
                    totalCumulative: JsonField<TotalCumulative> = JsonMissing.of(),
                    @JsonProperty("total_healthcare")
                    @ExcludeMissing
                    totalHealthcare: JsonField<TotalHealthcare> = JsonMissing.of(),
                    @JsonProperty("transit")
                    @ExcludeMissing
                    transit: JsonField<Transit> = JsonMissing.of(),
                    @JsonProperty("unknown")
                    @ExcludeMissing
                    unknown: JsonField<Unknown> = JsonMissing.of(),
                    @JsonProperty("vision")
                    @ExcludeMissing
                    vision: JsonField<Vision> = JsonMissing.of(),
                ) : this(
                    clinic,
                    dental,
                    original,
                    prescription,
                    surcharge,
                    totalCumulative,
                    totalHealthcare,
                    transit,
                    unknown,
                    vision,
                    mutableMapOf(),
                )

                /**
                 * The part of this transaction amount that was for clinic-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun clinic(): Optional<Clinic> = clinic.getOptional("clinic")

                /**
                 * The part of this transaction amount that was for dental-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun dental(): Optional<Dental> = dental.getOptional("dental")

                /**
                 * The original pre-authorized amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun original(): Optional<Original> = original.getOptional("original")

                /**
                 * The part of this transaction amount that was for healthcare prescriptions.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun prescription(): Optional<Prescription> =
                    prescription.getOptional("prescription")

                /**
                 * The surcharge amount charged for this transaction by the merchant.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun surcharge(): Optional<Surcharge> = surcharge.getOptional("surcharge")

                /**
                 * The total amount of a series of incremental authorizations, optionally provided.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun totalCumulative(): Optional<TotalCumulative> =
                    totalCumulative.getOptional("total_cumulative")

                /**
                 * The total amount of healthcare-related additional amounts.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun totalHealthcare(): Optional<TotalHealthcare> =
                    totalHealthcare.getOptional("total_healthcare")

                /**
                 * The part of this transaction amount that was for transit-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun transit(): Optional<Transit> = transit.getOptional("transit")

                /**
                 * An unknown additional amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun unknown(): Optional<Unknown> = unknown.getOptional("unknown")

                /**
                 * The part of this transaction amount that was for vision-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun vision(): Optional<Vision> = vision.getOptional("vision")

                /**
                 * Returns the raw JSON value of [clinic].
                 *
                 * Unlike [clinic], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("clinic") @ExcludeMissing fun _clinic(): JsonField<Clinic> = clinic

                /**
                 * Returns the raw JSON value of [dental].
                 *
                 * Unlike [dental], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("dental") @ExcludeMissing fun _dental(): JsonField<Dental> = dental

                /**
                 * Returns the raw JSON value of [original].
                 *
                 * Unlike [original], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("original")
                @ExcludeMissing
                fun _original(): JsonField<Original> = original

                /**
                 * Returns the raw JSON value of [prescription].
                 *
                 * Unlike [prescription], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("prescription")
                @ExcludeMissing
                fun _prescription(): JsonField<Prescription> = prescription

                /**
                 * Returns the raw JSON value of [surcharge].
                 *
                 * Unlike [surcharge], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("surcharge")
                @ExcludeMissing
                fun _surcharge(): JsonField<Surcharge> = surcharge

                /**
                 * Returns the raw JSON value of [totalCumulative].
                 *
                 * Unlike [totalCumulative], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("total_cumulative")
                @ExcludeMissing
                fun _totalCumulative(): JsonField<TotalCumulative> = totalCumulative

                /**
                 * Returns the raw JSON value of [totalHealthcare].
                 *
                 * Unlike [totalHealthcare], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("total_healthcare")
                @ExcludeMissing
                fun _totalHealthcare(): JsonField<TotalHealthcare> = totalHealthcare

                /**
                 * Returns the raw JSON value of [transit].
                 *
                 * Unlike [transit], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("transit")
                @ExcludeMissing
                fun _transit(): JsonField<Transit> = transit

                /**
                 * Returns the raw JSON value of [unknown].
                 *
                 * Unlike [unknown], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("unknown")
                @ExcludeMissing
                fun _unknown(): JsonField<Unknown> = unknown

                /**
                 * Returns the raw JSON value of [vision].
                 *
                 * Unlike [vision], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("vision") @ExcludeMissing fun _vision(): JsonField<Vision> = vision

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of
                     * [AdditionalAmounts].
                     *
                     * The following fields are required:
                     * ```java
                     * .clinic()
                     * .dental()
                     * .original()
                     * .prescription()
                     * .surcharge()
                     * .totalCumulative()
                     * .totalHealthcare()
                     * .transit()
                     * .unknown()
                     * .vision()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [AdditionalAmounts]. */
                class Builder internal constructor() {

                    private var clinic: JsonField<Clinic>? = null
                    private var dental: JsonField<Dental>? = null
                    private var original: JsonField<Original>? = null
                    private var prescription: JsonField<Prescription>? = null
                    private var surcharge: JsonField<Surcharge>? = null
                    private var totalCumulative: JsonField<TotalCumulative>? = null
                    private var totalHealthcare: JsonField<TotalHealthcare>? = null
                    private var transit: JsonField<Transit>? = null
                    private var unknown: JsonField<Unknown>? = null
                    private var vision: JsonField<Vision>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(additionalAmounts: AdditionalAmounts) = apply {
                        clinic = additionalAmounts.clinic
                        dental = additionalAmounts.dental
                        original = additionalAmounts.original
                        prescription = additionalAmounts.prescription
                        surcharge = additionalAmounts.surcharge
                        totalCumulative = additionalAmounts.totalCumulative
                        totalHealthcare = additionalAmounts.totalHealthcare
                        transit = additionalAmounts.transit
                        unknown = additionalAmounts.unknown
                        vision = additionalAmounts.vision
                        additionalProperties = additionalAmounts.additionalProperties.toMutableMap()
                    }

                    /** The part of this transaction amount that was for clinic-related services. */
                    fun clinic(clinic: Clinic?) = clinic(JsonField.ofNullable(clinic))

                    /** Alias for calling [Builder.clinic] with `clinic.orElse(null)`. */
                    fun clinic(clinic: Optional<Clinic>) = clinic(clinic.getOrNull())

                    /**
                     * Sets [Builder.clinic] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.clinic] with a well-typed [Clinic] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun clinic(clinic: JsonField<Clinic>) = apply { this.clinic = clinic }

                    /** The part of this transaction amount that was for dental-related services. */
                    fun dental(dental: Dental?) = dental(JsonField.ofNullable(dental))

                    /** Alias for calling [Builder.dental] with `dental.orElse(null)`. */
                    fun dental(dental: Optional<Dental>) = dental(dental.getOrNull())

                    /**
                     * Sets [Builder.dental] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.dental] with a well-typed [Dental] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun dental(dental: JsonField<Dental>) = apply { this.dental = dental }

                    /** The original pre-authorized amount. */
                    fun original(original: Original?) = original(JsonField.ofNullable(original))

                    /** Alias for calling [Builder.original] with `original.orElse(null)`. */
                    fun original(original: Optional<Original>) = original(original.getOrNull())

                    /**
                     * Sets [Builder.original] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.original] with a well-typed [Original] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun original(original: JsonField<Original>) = apply { this.original = original }

                    /**
                     * The part of this transaction amount that was for healthcare prescriptions.
                     */
                    fun prescription(prescription: Prescription?) =
                        prescription(JsonField.ofNullable(prescription))

                    /**
                     * Alias for calling [Builder.prescription] with `prescription.orElse(null)`.
                     */
                    fun prescription(prescription: Optional<Prescription>) =
                        prescription(prescription.getOrNull())

                    /**
                     * Sets [Builder.prescription] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.prescription] with a well-typed
                     * [Prescription] value instead. This method is primarily for setting the field
                     * to an undocumented or not yet supported value.
                     */
                    fun prescription(prescription: JsonField<Prescription>) = apply {
                        this.prescription = prescription
                    }

                    /** The surcharge amount charged for this transaction by the merchant. */
                    fun surcharge(surcharge: Surcharge?) =
                        surcharge(JsonField.ofNullable(surcharge))

                    /** Alias for calling [Builder.surcharge] with `surcharge.orElse(null)`. */
                    fun surcharge(surcharge: Optional<Surcharge>) = surcharge(surcharge.getOrNull())

                    /**
                     * Sets [Builder.surcharge] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.surcharge] with a well-typed [Surcharge]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun surcharge(surcharge: JsonField<Surcharge>) = apply {
                        this.surcharge = surcharge
                    }

                    /**
                     * The total amount of a series of incremental authorizations, optionally
                     * provided.
                     */
                    fun totalCumulative(totalCumulative: TotalCumulative?) =
                        totalCumulative(JsonField.ofNullable(totalCumulative))

                    /**
                     * Alias for calling [Builder.totalCumulative] with
                     * `totalCumulative.orElse(null)`.
                     */
                    fun totalCumulative(totalCumulative: Optional<TotalCumulative>) =
                        totalCumulative(totalCumulative.getOrNull())

                    /**
                     * Sets [Builder.totalCumulative] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.totalCumulative] with a well-typed
                     * [TotalCumulative] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun totalCumulative(totalCumulative: JsonField<TotalCumulative>) = apply {
                        this.totalCumulative = totalCumulative
                    }

                    /** The total amount of healthcare-related additional amounts. */
                    fun totalHealthcare(totalHealthcare: TotalHealthcare?) =
                        totalHealthcare(JsonField.ofNullable(totalHealthcare))

                    /**
                     * Alias for calling [Builder.totalHealthcare] with
                     * `totalHealthcare.orElse(null)`.
                     */
                    fun totalHealthcare(totalHealthcare: Optional<TotalHealthcare>) =
                        totalHealthcare(totalHealthcare.getOrNull())

                    /**
                     * Sets [Builder.totalHealthcare] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.totalHealthcare] with a well-typed
                     * [TotalHealthcare] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun totalHealthcare(totalHealthcare: JsonField<TotalHealthcare>) = apply {
                        this.totalHealthcare = totalHealthcare
                    }

                    /**
                     * The part of this transaction amount that was for transit-related services.
                     */
                    fun transit(transit: Transit?) = transit(JsonField.ofNullable(transit))

                    /** Alias for calling [Builder.transit] with `transit.orElse(null)`. */
                    fun transit(transit: Optional<Transit>) = transit(transit.getOrNull())

                    /**
                     * Sets [Builder.transit] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.transit] with a well-typed [Transit] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun transit(transit: JsonField<Transit>) = apply { this.transit = transit }

                    /** An unknown additional amount. */
                    fun unknown(unknown: Unknown?) = unknown(JsonField.ofNullable(unknown))

                    /** Alias for calling [Builder.unknown] with `unknown.orElse(null)`. */
                    fun unknown(unknown: Optional<Unknown>) = unknown(unknown.getOrNull())

                    /**
                     * Sets [Builder.unknown] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.unknown] with a well-typed [Unknown] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun unknown(unknown: JsonField<Unknown>) = apply { this.unknown = unknown }

                    /** The part of this transaction amount that was for vision-related services. */
                    fun vision(vision: Vision?) = vision(JsonField.ofNullable(vision))

                    /** Alias for calling [Builder.vision] with `vision.orElse(null)`. */
                    fun vision(vision: Optional<Vision>) = vision(vision.getOrNull())

                    /**
                     * Sets [Builder.vision] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.vision] with a well-typed [Vision] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun vision(vision: JsonField<Vision>) = apply { this.vision = vision }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [AdditionalAmounts].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .clinic()
                     * .dental()
                     * .original()
                     * .prescription()
                     * .surcharge()
                     * .totalCumulative()
                     * .totalHealthcare()
                     * .transit()
                     * .unknown()
                     * .vision()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): AdditionalAmounts =
                        AdditionalAmounts(
                            checkRequired("clinic", clinic),
                            checkRequired("dental", dental),
                            checkRequired("original", original),
                            checkRequired("prescription", prescription),
                            checkRequired("surcharge", surcharge),
                            checkRequired("totalCumulative", totalCumulative),
                            checkRequired("totalHealthcare", totalHealthcare),
                            checkRequired("transit", transit),
                            checkRequired("unknown", unknown),
                            checkRequired("vision", vision),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): AdditionalAmounts = apply {
                    if (validated) {
                        return@apply
                    }

                    clinic().ifPresent { it.validate() }
                    dental().ifPresent { it.validate() }
                    original().ifPresent { it.validate() }
                    prescription().ifPresent { it.validate() }
                    surcharge().ifPresent { it.validate() }
                    totalCumulative().ifPresent { it.validate() }
                    totalHealthcare().ifPresent { it.validate() }
                    transit().ifPresent { it.validate() }
                    unknown().ifPresent { it.validate() }
                    vision().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (clinic.asKnown().getOrNull()?.validity() ?: 0) +
                        (dental.asKnown().getOrNull()?.validity() ?: 0) +
                        (original.asKnown().getOrNull()?.validity() ?: 0) +
                        (prescription.asKnown().getOrNull()?.validity() ?: 0) +
                        (surcharge.asKnown().getOrNull()?.validity() ?: 0) +
                        (totalCumulative.asKnown().getOrNull()?.validity() ?: 0) +
                        (totalHealthcare.asKnown().getOrNull()?.validity() ?: 0) +
                        (transit.asKnown().getOrNull()?.validity() ?: 0) +
                        (unknown.asKnown().getOrNull()?.validity() ?: 0) +
                        (vision.asKnown().getOrNull()?.validity() ?: 0)

                /** The part of this transaction amount that was for clinic-related services. */
                class Clinic
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Clinic].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Clinic]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(clinic: Clinic) = apply {
                            amount = clinic.amount
                            currency = clinic.currency
                            additionalProperties = clinic.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Clinic].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Clinic =
                            Clinic(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Clinic = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Clinic &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Clinic{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for dental-related services. */
                class Dental
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Dental].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Dental]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(dental: Dental) = apply {
                            amount = dental.amount
                            currency = dental.currency
                            additionalProperties = dental.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Dental].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Dental =
                            Dental(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Dental = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Dental &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Dental{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The original pre-authorized amount. */
                class Original
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Original].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Original]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(original: Original) = apply {
                            amount = original.amount
                            currency = original.currency
                            additionalProperties = original.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Original].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Original =
                            Original(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Original = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Original &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Original{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for healthcare prescriptions. */
                class Prescription
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Prescription].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Prescription]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(prescription: Prescription) = apply {
                            amount = prescription.amount
                            currency = prescription.currency
                            additionalProperties = prescription.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Prescription].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Prescription =
                            Prescription(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Prescription = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Prescription &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Prescription{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The surcharge amount charged for this transaction by the merchant. */
                class Surcharge
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Surcharge].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Surcharge]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(surcharge: Surcharge) = apply {
                            amount = surcharge.amount
                            currency = surcharge.currency
                            additionalProperties = surcharge.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Surcharge].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Surcharge =
                            Surcharge(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Surcharge = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Surcharge &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Surcharge{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /**
                 * The total amount of a series of incremental authorizations, optionally provided.
                 */
                class TotalCumulative
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [TotalCumulative].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [TotalCumulative]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(totalCumulative: TotalCumulative) = apply {
                            amount = totalCumulative.amount
                            currency = totalCumulative.currency
                            additionalProperties =
                                totalCumulative.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [TotalCumulative].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): TotalCumulative =
                            TotalCumulative(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): TotalCumulative = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is TotalCumulative &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "TotalCumulative{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The total amount of healthcare-related additional amounts. */
                class TotalHealthcare
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [TotalHealthcare].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [TotalHealthcare]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(totalHealthcare: TotalHealthcare) = apply {
                            amount = totalHealthcare.amount
                            currency = totalHealthcare.currency
                            additionalProperties =
                                totalHealthcare.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [TotalHealthcare].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): TotalHealthcare =
                            TotalHealthcare(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): TotalHealthcare = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is TotalHealthcare &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "TotalHealthcare{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for transit-related services. */
                class Transit
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Transit].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Transit]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(transit: Transit) = apply {
                            amount = transit.amount
                            currency = transit.currency
                            additionalProperties = transit.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Transit].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Transit =
                            Transit(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Transit = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Transit &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Transit{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** An unknown additional amount. */
                class Unknown
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Unknown].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Unknown]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(unknown: Unknown) = apply {
                            amount = unknown.amount
                            currency = unknown.currency
                            additionalProperties = unknown.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Unknown].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Unknown =
                            Unknown(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Unknown = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Unknown &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Unknown{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for vision-related services. */
                class Vision
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Vision].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Vision]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(vision: Vision) = apply {
                            amount = vision.amount
                            currency = vision.currency
                            additionalProperties = vision.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Vision].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Vision =
                            Vision(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Vision = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Vision &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Vision{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is AdditionalAmounts &&
                        clinic == other.clinic &&
                        dental == other.dental &&
                        original == other.original &&
                        prescription == other.prescription &&
                        surcharge == other.surcharge &&
                        totalCumulative == other.totalCumulative &&
                        totalHealthcare == other.totalHealthcare &&
                        transit == other.transit &&
                        unknown == other.unknown &&
                        vision == other.vision &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        clinic,
                        dental,
                        original,
                        prescription,
                        surcharge,
                        totalCumulative,
                        totalHealthcare,
                        transit,
                        unknown,
                        vision,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "AdditionalAmounts{clinic=$clinic, dental=$dental, original=$original, prescription=$prescription, surcharge=$surcharge, totalCumulative=$totalCumulative, totalHealthcare=$totalHealthcare, transit=$transit, unknown=$unknown, vision=$vision, additionalProperties=$additionalProperties}"
            }

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the account's
             * currency.
             */
            class Currency @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** US Dollar (USD) */
                    @JvmField val USD = of("USD")

                    @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                }

                /** An enum containing [Currency]'s known values. */
                enum class Known {
                    /** US Dollar (USD) */
                    USD
                }

                /**
                 * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Currency] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** US Dollar (USD) */
                    USD,
                    /**
                     * An enum member indicating that [Currency] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        USD -> Value.USD
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        USD -> Known.USD
                        else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Currency = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Currency && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** Fields specific to the `network`. */
            class NetworkDetails
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val category: JsonField<Category>,
                private val pulse: JsonField<Pulse>,
                private val visa: JsonField<Visa>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("category")
                    @ExcludeMissing
                    category: JsonField<Category> = JsonMissing.of(),
                    @JsonProperty("pulse")
                    @ExcludeMissing
                    pulse: JsonField<Pulse> = JsonMissing.of(),
                    @JsonProperty("visa") @ExcludeMissing visa: JsonField<Visa> = JsonMissing.of(),
                ) : this(category, pulse, visa, mutableMapOf())

                /**
                 * The payment network used to process this card authorization.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun category(): Category = category.getRequired("category")

                /**
                 * Fields specific to the `pulse` network.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun pulse(): Optional<Pulse> = pulse.getOptional("pulse")

                /**
                 * Fields specific to the `visa` network.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun visa(): Optional<Visa> = visa.getOptional("visa")

                /**
                 * Returns the raw JSON value of [category].
                 *
                 * Unlike [category], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("category")
                @ExcludeMissing
                fun _category(): JsonField<Category> = category

                /**
                 * Returns the raw JSON value of [pulse].
                 *
                 * Unlike [pulse], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("pulse") @ExcludeMissing fun _pulse(): JsonField<Pulse> = pulse

                /**
                 * Returns the raw JSON value of [visa].
                 *
                 * Unlike [visa], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("visa") @ExcludeMissing fun _visa(): JsonField<Visa> = visa

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [NetworkDetails].
                     *
                     * The following fields are required:
                     * ```java
                     * .category()
                     * .pulse()
                     * .visa()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [NetworkDetails]. */
                class Builder internal constructor() {

                    private var category: JsonField<Category>? = null
                    private var pulse: JsonField<Pulse>? = null
                    private var visa: JsonField<Visa>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(networkDetails: NetworkDetails) = apply {
                        category = networkDetails.category
                        pulse = networkDetails.pulse
                        visa = networkDetails.visa
                        additionalProperties = networkDetails.additionalProperties.toMutableMap()
                    }

                    /** The payment network used to process this card authorization. */
                    fun category(category: Category) = category(JsonField.of(category))

                    /**
                     * Sets [Builder.category] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.category] with a well-typed [Category] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun category(category: JsonField<Category>) = apply { this.category = category }

                    /** Fields specific to the `pulse` network. */
                    fun pulse(pulse: Pulse?) = pulse(JsonField.ofNullable(pulse))

                    /** Alias for calling [Builder.pulse] with `pulse.orElse(null)`. */
                    fun pulse(pulse: Optional<Pulse>) = pulse(pulse.getOrNull())

                    /**
                     * Sets [Builder.pulse] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.pulse] with a well-typed [Pulse] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun pulse(pulse: JsonField<Pulse>) = apply { this.pulse = pulse }

                    /** Fields specific to the `visa` network. */
                    fun visa(visa: Visa?) = visa(JsonField.ofNullable(visa))

                    /** Alias for calling [Builder.visa] with `visa.orElse(null)`. */
                    fun visa(visa: Optional<Visa>) = visa(visa.getOrNull())

                    /**
                     * Sets [Builder.visa] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.visa] with a well-typed [Visa] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun visa(visa: JsonField<Visa>) = apply { this.visa = visa }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [NetworkDetails].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .category()
                     * .pulse()
                     * .visa()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): NetworkDetails =
                        NetworkDetails(
                            checkRequired("category", category),
                            checkRequired("pulse", pulse),
                            checkRequired("visa", visa),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): NetworkDetails = apply {
                    if (validated) {
                        return@apply
                    }

                    category().validate()
                    pulse().ifPresent { it.validate() }
                    visa().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (category.asKnown().getOrNull()?.validity() ?: 0) +
                        (pulse.asKnown().getOrNull()?.validity() ?: 0) +
                        (visa.asKnown().getOrNull()?.validity() ?: 0)

                /** The payment network used to process this card authorization. */
                class Category
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** Visa */
                        @JvmField val VISA = of("visa")

                        /** Pulse */
                        @JvmField val PULSE = of("pulse")

                        @JvmStatic fun of(value: String) = Category(JsonField.of(value))
                    }

                    /** An enum containing [Category]'s known values. */
                    enum class Known {
                        /** Visa */
                        VISA,
                        /** Pulse */
                        PULSE,
                    }

                    /**
                     * An enum containing [Category]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Category] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** Visa */
                        VISA,
                        /** Pulse */
                        PULSE,
                        /**
                         * An enum member indicating that [Category] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            VISA -> Value.VISA
                            PULSE -> Value.PULSE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            VISA -> Known.VISA
                            PULSE -> Known.PULSE
                            else -> throw IncreaseInvalidDataException("Unknown Category: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Category = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Category && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** Fields specific to the `pulse` network. */
                class Pulse
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val additionalProperties: MutableMap<String, JsonValue>
                ) {

                    @JsonCreator private constructor() : this(mutableMapOf())

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /** Returns a mutable builder for constructing an instance of [Pulse]. */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Pulse]. */
                    class Builder internal constructor() {

                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(pulse: Pulse) = apply {
                            additionalProperties = pulse.additionalProperties.toMutableMap()
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Pulse].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         */
                        fun build(): Pulse = Pulse(additionalProperties.toMutableMap())
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Pulse = apply {
                        if (validated) {
                            return@apply
                        }

                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic internal fun validity(): Int = 0

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Pulse && additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy { Objects.hash(additionalProperties) }

                    override fun hashCode(): Int = hashCode

                    override fun toString() = "Pulse{additionalProperties=$additionalProperties}"
                }

                /** Fields specific to the `visa` network. */
                class Visa
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val electronicCommerceIndicator: JsonField<ElectronicCommerceIndicator>,
                    private val pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode>,
                    private val standInProcessingReason: JsonField<StandInProcessingReason>,
                    private val terminalEntryCapability: JsonField<TerminalEntryCapability>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("electronic_commerce_indicator")
                        @ExcludeMissing
                        electronicCommerceIndicator: JsonField<ElectronicCommerceIndicator> =
                            JsonMissing.of(),
                        @JsonProperty("point_of_service_entry_mode")
                        @ExcludeMissing
                        pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode> =
                            JsonMissing.of(),
                        @JsonProperty("stand_in_processing_reason")
                        @ExcludeMissing
                        standInProcessingReason: JsonField<StandInProcessingReason> =
                            JsonMissing.of(),
                        @JsonProperty("terminal_entry_capability")
                        @ExcludeMissing
                        terminalEntryCapability: JsonField<TerminalEntryCapability> =
                            JsonMissing.of(),
                    ) : this(
                        electronicCommerceIndicator,
                        pointOfServiceEntryMode,
                        standInProcessingReason,
                        terminalEntryCapability,
                        mutableMapOf(),
                    )

                    /**
                     * For electronic commerce transactions, this identifies the level of security
                     * used in obtaining the customer's payment credential. For mail or telephone
                     * order transactions, identifies the type of mail or telephone order.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun electronicCommerceIndicator(): Optional<ElectronicCommerceIndicator> =
                        electronicCommerceIndicator.getOptional("electronic_commerce_indicator")

                    /**
                     * The method used to enter the cardholder's primary account number and card
                     * expiration date.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun pointOfServiceEntryMode(): Optional<PointOfServiceEntryMode> =
                        pointOfServiceEntryMode.getOptional("point_of_service_entry_mode")

                    /**
                     * Only present when `actioner: network`. Describes why a card authorization was
                     * approved or declined by Visa through stand-in processing.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun standInProcessingReason(): Optional<StandInProcessingReason> =
                        standInProcessingReason.getOptional("stand_in_processing_reason")

                    /**
                     * The capability of the terminal being used to read the card. Shows whether a
                     * terminal can e.g., accept chip cards or if it only supports magnetic stripe
                     * reads. This reflects the highest capability of the terminal — for example, a
                     * terminal that supports both chip and magnetic stripe will be identified as
                     * chip-capable.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun terminalEntryCapability(): Optional<TerminalEntryCapability> =
                        terminalEntryCapability.getOptional("terminal_entry_capability")

                    /**
                     * Returns the raw JSON value of [electronicCommerceIndicator].
                     *
                     * Unlike [electronicCommerceIndicator], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("electronic_commerce_indicator")
                    @ExcludeMissing
                    fun _electronicCommerceIndicator(): JsonField<ElectronicCommerceIndicator> =
                        electronicCommerceIndicator

                    /**
                     * Returns the raw JSON value of [pointOfServiceEntryMode].
                     *
                     * Unlike [pointOfServiceEntryMode], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("point_of_service_entry_mode")
                    @ExcludeMissing
                    fun _pointOfServiceEntryMode(): JsonField<PointOfServiceEntryMode> =
                        pointOfServiceEntryMode

                    /**
                     * Returns the raw JSON value of [standInProcessingReason].
                     *
                     * Unlike [standInProcessingReason], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("stand_in_processing_reason")
                    @ExcludeMissing
                    fun _standInProcessingReason(): JsonField<StandInProcessingReason> =
                        standInProcessingReason

                    /**
                     * Returns the raw JSON value of [terminalEntryCapability].
                     *
                     * Unlike [terminalEntryCapability], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("terminal_entry_capability")
                    @ExcludeMissing
                    fun _terminalEntryCapability(): JsonField<TerminalEntryCapability> =
                        terminalEntryCapability

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Visa].
                         *
                         * The following fields are required:
                         * ```java
                         * .electronicCommerceIndicator()
                         * .pointOfServiceEntryMode()
                         * .standInProcessingReason()
                         * .terminalEntryCapability()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Visa]. */
                    class Builder internal constructor() {

                        private var electronicCommerceIndicator:
                            JsonField<ElectronicCommerceIndicator>? =
                            null
                        private var pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode>? =
                            null
                        private var standInProcessingReason: JsonField<StandInProcessingReason>? =
                            null
                        private var terminalEntryCapability: JsonField<TerminalEntryCapability>? =
                            null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(visa: Visa) = apply {
                            electronicCommerceIndicator = visa.electronicCommerceIndicator
                            pointOfServiceEntryMode = visa.pointOfServiceEntryMode
                            standInProcessingReason = visa.standInProcessingReason
                            terminalEntryCapability = visa.terminalEntryCapability
                            additionalProperties = visa.additionalProperties.toMutableMap()
                        }

                        /**
                         * For electronic commerce transactions, this identifies the level of
                         * security used in obtaining the customer's payment credential. For mail or
                         * telephone order transactions, identifies the type of mail or telephone
                         * order.
                         */
                        fun electronicCommerceIndicator(
                            electronicCommerceIndicator: ElectronicCommerceIndicator?
                        ) =
                            electronicCommerceIndicator(
                                JsonField.ofNullable(electronicCommerceIndicator)
                            )

                        /**
                         * Alias for calling [Builder.electronicCommerceIndicator] with
                         * `electronicCommerceIndicator.orElse(null)`.
                         */
                        fun electronicCommerceIndicator(
                            electronicCommerceIndicator: Optional<ElectronicCommerceIndicator>
                        ) = electronicCommerceIndicator(electronicCommerceIndicator.getOrNull())

                        /**
                         * Sets [Builder.electronicCommerceIndicator] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.electronicCommerceIndicator] with a
                         * well-typed [ElectronicCommerceIndicator] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun electronicCommerceIndicator(
                            electronicCommerceIndicator: JsonField<ElectronicCommerceIndicator>
                        ) = apply { this.electronicCommerceIndicator = electronicCommerceIndicator }

                        /**
                         * The method used to enter the cardholder's primary account number and card
                         * expiration date.
                         */
                        fun pointOfServiceEntryMode(
                            pointOfServiceEntryMode: PointOfServiceEntryMode?
                        ) = pointOfServiceEntryMode(JsonField.ofNullable(pointOfServiceEntryMode))

                        /**
                         * Alias for calling [Builder.pointOfServiceEntryMode] with
                         * `pointOfServiceEntryMode.orElse(null)`.
                         */
                        fun pointOfServiceEntryMode(
                            pointOfServiceEntryMode: Optional<PointOfServiceEntryMode>
                        ) = pointOfServiceEntryMode(pointOfServiceEntryMode.getOrNull())

                        /**
                         * Sets [Builder.pointOfServiceEntryMode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.pointOfServiceEntryMode] with a
                         * well-typed [PointOfServiceEntryMode] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun pointOfServiceEntryMode(
                            pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode>
                        ) = apply { this.pointOfServiceEntryMode = pointOfServiceEntryMode }

                        /**
                         * Only present when `actioner: network`. Describes why a card authorization
                         * was approved or declined by Visa through stand-in processing.
                         */
                        fun standInProcessingReason(
                            standInProcessingReason: StandInProcessingReason?
                        ) = standInProcessingReason(JsonField.ofNullable(standInProcessingReason))

                        /**
                         * Alias for calling [Builder.standInProcessingReason] with
                         * `standInProcessingReason.orElse(null)`.
                         */
                        fun standInProcessingReason(
                            standInProcessingReason: Optional<StandInProcessingReason>
                        ) = standInProcessingReason(standInProcessingReason.getOrNull())

                        /**
                         * Sets [Builder.standInProcessingReason] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.standInProcessingReason] with a
                         * well-typed [StandInProcessingReason] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun standInProcessingReason(
                            standInProcessingReason: JsonField<StandInProcessingReason>
                        ) = apply { this.standInProcessingReason = standInProcessingReason }

                        /**
                         * The capability of the terminal being used to read the card. Shows whether
                         * a terminal can e.g., accept chip cards or if it only supports magnetic
                         * stripe reads. This reflects the highest capability of the terminal — for
                         * example, a terminal that supports both chip and magnetic stripe will be
                         * identified as chip-capable.
                         */
                        fun terminalEntryCapability(
                            terminalEntryCapability: TerminalEntryCapability?
                        ) = terminalEntryCapability(JsonField.ofNullable(terminalEntryCapability))

                        /**
                         * Alias for calling [Builder.terminalEntryCapability] with
                         * `terminalEntryCapability.orElse(null)`.
                         */
                        fun terminalEntryCapability(
                            terminalEntryCapability: Optional<TerminalEntryCapability>
                        ) = terminalEntryCapability(terminalEntryCapability.getOrNull())

                        /**
                         * Sets [Builder.terminalEntryCapability] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.terminalEntryCapability] with a
                         * well-typed [TerminalEntryCapability] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun terminalEntryCapability(
                            terminalEntryCapability: JsonField<TerminalEntryCapability>
                        ) = apply { this.terminalEntryCapability = terminalEntryCapability }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Visa].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .electronicCommerceIndicator()
                         * .pointOfServiceEntryMode()
                         * .standInProcessingReason()
                         * .terminalEntryCapability()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Visa =
                            Visa(
                                checkRequired(
                                    "electronicCommerceIndicator",
                                    electronicCommerceIndicator,
                                ),
                                checkRequired("pointOfServiceEntryMode", pointOfServiceEntryMode),
                                checkRequired("standInProcessingReason", standInProcessingReason),
                                checkRequired("terminalEntryCapability", terminalEntryCapability),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Visa = apply {
                        if (validated) {
                            return@apply
                        }

                        electronicCommerceIndicator().ifPresent { it.validate() }
                        pointOfServiceEntryMode().ifPresent { it.validate() }
                        standInProcessingReason().ifPresent { it.validate() }
                        terminalEntryCapability().ifPresent { it.validate() }
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (electronicCommerceIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                            (pointOfServiceEntryMode.asKnown().getOrNull()?.validity() ?: 0) +
                            (standInProcessingReason.asKnown().getOrNull()?.validity() ?: 0) +
                            (terminalEntryCapability.asKnown().getOrNull()?.validity() ?: 0)

                    /**
                     * For electronic commerce transactions, this identifies the level of security
                     * used in obtaining the customer's payment credential. For mail or telephone
                     * order transactions, identifies the type of mail or telephone order.
                     */
                    class ElectronicCommerceIndicator
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /**
                             * Single transaction of a mail/phone order: Use to indicate that the
                             * transaction is a mail/phone order purchase, not a recurring
                             * transaction or installment payment. For domestic transactions in the
                             * US region, this value may also indicate one bill payment transaction
                             * in the card-present or card-absent environments.
                             */
                            @JvmField val MAIL_PHONE_ORDER = of("mail_phone_order")

                            /**
                             * Recurring transaction: Payment indicator used to indicate a recurring
                             * transaction that originates from an acquirer in the US region.
                             */
                            @JvmField val RECURRING = of("recurring")

                            /**
                             * Installment payment: Payment indicator used to indicate one purchase
                             * of goods or services that is billed to the account in multiple
                             * charges over a period of time agreed upon by the cardholder and
                             * merchant from transactions that originate from an acquirer in the US
                             * region.
                             */
                            @JvmField val INSTALLMENT = of("installment")

                            /**
                             * Unknown classification: other mail order: Use to indicate that the
                             * type of mail/telephone order is unknown.
                             */
                            @JvmField val UNKNOWN_MAIL_PHONE_ORDER = of("unknown_mail_phone_order")

                            /**
                             * Secure electronic commerce transaction: Use to indicate that the
                             * electronic commerce transaction has been authenticated using e.g.,
                             * 3-D Secure
                             */
                            @JvmField
                            val SECURE_ELECTRONIC_COMMERCE = of("secure_electronic_commerce")

                            /**
                             * Non-authenticated security transaction at a 3-D Secure-capable
                             * merchant, and merchant attempted to authenticate the cardholder using
                             * 3-D Secure: Use to identify an electronic commerce transaction where
                             * the merchant attempted to authenticate the cardholder using 3-D
                             * Secure, but was unable to complete the authentication because the
                             * issuer or cardholder does not participate in the 3-D Secure program.
                             */
                            @JvmField
                            val NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT =
                                of("non_authenticated_security_transaction_at_3ds_capable_merchant")

                            /**
                             * Non-authenticated security transaction: Use to identify an electronic
                             * commerce transaction that uses data encryption for security however,
                             * cardholder authentication is not performed using 3-D Secure.
                             */
                            @JvmField
                            val NON_AUTHENTICATED_SECURITY_TRANSACTION =
                                of("non_authenticated_security_transaction")

                            /**
                             * Non-secure transaction: Use to identify an electronic commerce
                             * transaction that has no data protection.
                             */
                            @JvmField val NON_SECURE_TRANSACTION = of("non_secure_transaction")

                            @JvmStatic
                            fun of(value: String) = ElectronicCommerceIndicator(JsonField.of(value))
                        }

                        /** An enum containing [ElectronicCommerceIndicator]'s known values. */
                        enum class Known {
                            /**
                             * Single transaction of a mail/phone order: Use to indicate that the
                             * transaction is a mail/phone order purchase, not a recurring
                             * transaction or installment payment. For domestic transactions in the
                             * US region, this value may also indicate one bill payment transaction
                             * in the card-present or card-absent environments.
                             */
                            MAIL_PHONE_ORDER,
                            /**
                             * Recurring transaction: Payment indicator used to indicate a recurring
                             * transaction that originates from an acquirer in the US region.
                             */
                            RECURRING,
                            /**
                             * Installment payment: Payment indicator used to indicate one purchase
                             * of goods or services that is billed to the account in multiple
                             * charges over a period of time agreed upon by the cardholder and
                             * merchant from transactions that originate from an acquirer in the US
                             * region.
                             */
                            INSTALLMENT,
                            /**
                             * Unknown classification: other mail order: Use to indicate that the
                             * type of mail/telephone order is unknown.
                             */
                            UNKNOWN_MAIL_PHONE_ORDER,
                            /**
                             * Secure electronic commerce transaction: Use to indicate that the
                             * electronic commerce transaction has been authenticated using e.g.,
                             * 3-D Secure
                             */
                            SECURE_ELECTRONIC_COMMERCE,
                            /**
                             * Non-authenticated security transaction at a 3-D Secure-capable
                             * merchant, and merchant attempted to authenticate the cardholder using
                             * 3-D Secure: Use to identify an electronic commerce transaction where
                             * the merchant attempted to authenticate the cardholder using 3-D
                             * Secure, but was unable to complete the authentication because the
                             * issuer or cardholder does not participate in the 3-D Secure program.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT,
                            /**
                             * Non-authenticated security transaction: Use to identify an electronic
                             * commerce transaction that uses data encryption for security however,
                             * cardholder authentication is not performed using 3-D Secure.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION,
                            /**
                             * Non-secure transaction: Use to identify an electronic commerce
                             * transaction that has no data protection.
                             */
                            NON_SECURE_TRANSACTION,
                        }

                        /**
                         * An enum containing [ElectronicCommerceIndicator]'s known values, as well
                         * as an [_UNKNOWN] member.
                         *
                         * An instance of [ElectronicCommerceIndicator] can contain an unknown value
                         * in a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /**
                             * Single transaction of a mail/phone order: Use to indicate that the
                             * transaction is a mail/phone order purchase, not a recurring
                             * transaction or installment payment. For domestic transactions in the
                             * US region, this value may also indicate one bill payment transaction
                             * in the card-present or card-absent environments.
                             */
                            MAIL_PHONE_ORDER,
                            /**
                             * Recurring transaction: Payment indicator used to indicate a recurring
                             * transaction that originates from an acquirer in the US region.
                             */
                            RECURRING,
                            /**
                             * Installment payment: Payment indicator used to indicate one purchase
                             * of goods or services that is billed to the account in multiple
                             * charges over a period of time agreed upon by the cardholder and
                             * merchant from transactions that originate from an acquirer in the US
                             * region.
                             */
                            INSTALLMENT,
                            /**
                             * Unknown classification: other mail order: Use to indicate that the
                             * type of mail/telephone order is unknown.
                             */
                            UNKNOWN_MAIL_PHONE_ORDER,
                            /**
                             * Secure electronic commerce transaction: Use to indicate that the
                             * electronic commerce transaction has been authenticated using e.g.,
                             * 3-D Secure
                             */
                            SECURE_ELECTRONIC_COMMERCE,
                            /**
                             * Non-authenticated security transaction at a 3-D Secure-capable
                             * merchant, and merchant attempted to authenticate the cardholder using
                             * 3-D Secure: Use to identify an electronic commerce transaction where
                             * the merchant attempted to authenticate the cardholder using 3-D
                             * Secure, but was unable to complete the authentication because the
                             * issuer or cardholder does not participate in the 3-D Secure program.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT,
                            /**
                             * Non-authenticated security transaction: Use to identify an electronic
                             * commerce transaction that uses data encryption for security however,
                             * cardholder authentication is not performed using 3-D Secure.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION,
                            /**
                             * Non-secure transaction: Use to identify an electronic commerce
                             * transaction that has no data protection.
                             */
                            NON_SECURE_TRANSACTION,
                            /**
                             * An enum member indicating that [ElectronicCommerceIndicator] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                MAIL_PHONE_ORDER -> Value.MAIL_PHONE_ORDER
                                RECURRING -> Value.RECURRING
                                INSTALLMENT -> Value.INSTALLMENT
                                UNKNOWN_MAIL_PHONE_ORDER -> Value.UNKNOWN_MAIL_PHONE_ORDER
                                SECURE_ELECTRONIC_COMMERCE -> Value.SECURE_ELECTRONIC_COMMERCE
                                NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT ->
                                    Value
                                        .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT
                                NON_AUTHENTICATED_SECURITY_TRANSACTION ->
                                    Value.NON_AUTHENTICATED_SECURITY_TRANSACTION
                                NON_SECURE_TRANSACTION -> Value.NON_SECURE_TRANSACTION
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                MAIL_PHONE_ORDER -> Known.MAIL_PHONE_ORDER
                                RECURRING -> Known.RECURRING
                                INSTALLMENT -> Known.INSTALLMENT
                                UNKNOWN_MAIL_PHONE_ORDER -> Known.UNKNOWN_MAIL_PHONE_ORDER
                                SECURE_ELECTRONIC_COMMERCE -> Known.SECURE_ELECTRONIC_COMMERCE
                                NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT ->
                                    Known
                                        .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT
                                NON_AUTHENTICATED_SECURITY_TRANSACTION ->
                                    Known.NON_AUTHENTICATED_SECURITY_TRANSACTION
                                NON_SECURE_TRANSACTION -> Known.NON_SECURE_TRANSACTION
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown ElectronicCommerceIndicator: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): ElectronicCommerceIndicator = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is ElectronicCommerceIndicator && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * The method used to enter the cardholder's primary account number and card
                     * expiration date.
                     */
                    class PointOfServiceEntryMode
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Unknown */
                            @JvmField val UNKNOWN = of("unknown")

                            /** Manual key entry */
                            @JvmField val MANUAL = of("manual")

                            /** Magnetic stripe read, without card verification value */
                            @JvmField val MAGNETIC_STRIPE_NO_CVV = of("magnetic_stripe_no_cvv")

                            /** Optical code */
                            @JvmField val OPTICAL_CODE = of("optical_code")

                            /** Contact chip card */
                            @JvmField val INTEGRATED_CIRCUIT_CARD = of("integrated_circuit_card")

                            /** Contactless read of chip card */
                            @JvmField val CONTACTLESS = of("contactless")

                            /**
                             * Transaction initiated using a credential that has previously been
                             * stored on file
                             */
                            @JvmField val CREDENTIAL_ON_FILE = of("credential_on_file")

                            /** Magnetic stripe read */
                            @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe")

                            /** Contactless read of magnetic stripe data */
                            @JvmField
                            val CONTACTLESS_MAGNETIC_STRIPE = of("contactless_magnetic_stripe")

                            /** Contact chip card, without card verification value */
                            @JvmField
                            val INTEGRATED_CIRCUIT_CARD_NO_CVV =
                                of("integrated_circuit_card_no_cvv")

                            @JvmStatic
                            fun of(value: String) = PointOfServiceEntryMode(JsonField.of(value))
                        }

                        /** An enum containing [PointOfServiceEntryMode]'s known values. */
                        enum class Known {
                            /** Unknown */
                            UNKNOWN,
                            /** Manual key entry */
                            MANUAL,
                            /** Magnetic stripe read, without card verification value */
                            MAGNETIC_STRIPE_NO_CVV,
                            /** Optical code */
                            OPTICAL_CODE,
                            /** Contact chip card */
                            INTEGRATED_CIRCUIT_CARD,
                            /** Contactless read of chip card */
                            CONTACTLESS,
                            /**
                             * Transaction initiated using a credential that has previously been
                             * stored on file
                             */
                            CREDENTIAL_ON_FILE,
                            /** Magnetic stripe read */
                            MAGNETIC_STRIPE,
                            /** Contactless read of magnetic stripe data */
                            CONTACTLESS_MAGNETIC_STRIPE,
                            /** Contact chip card, without card verification value */
                            INTEGRATED_CIRCUIT_CARD_NO_CVV,
                        }

                        /**
                         * An enum containing [PointOfServiceEntryMode]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [PointOfServiceEntryMode] can contain an unknown value in
                         * a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Unknown */
                            UNKNOWN,
                            /** Manual key entry */
                            MANUAL,
                            /** Magnetic stripe read, without card verification value */
                            MAGNETIC_STRIPE_NO_CVV,
                            /** Optical code */
                            OPTICAL_CODE,
                            /** Contact chip card */
                            INTEGRATED_CIRCUIT_CARD,
                            /** Contactless read of chip card */
                            CONTACTLESS,
                            /**
                             * Transaction initiated using a credential that has previously been
                             * stored on file
                             */
                            CREDENTIAL_ON_FILE,
                            /** Magnetic stripe read */
                            MAGNETIC_STRIPE,
                            /** Contactless read of magnetic stripe data */
                            CONTACTLESS_MAGNETIC_STRIPE,
                            /** Contact chip card, without card verification value */
                            INTEGRATED_CIRCUIT_CARD_NO_CVV,
                            /**
                             * An enum member indicating that [PointOfServiceEntryMode] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                UNKNOWN -> Value.UNKNOWN
                                MANUAL -> Value.MANUAL
                                MAGNETIC_STRIPE_NO_CVV -> Value.MAGNETIC_STRIPE_NO_CVV
                                OPTICAL_CODE -> Value.OPTICAL_CODE
                                INTEGRATED_CIRCUIT_CARD -> Value.INTEGRATED_CIRCUIT_CARD
                                CONTACTLESS -> Value.CONTACTLESS
                                CREDENTIAL_ON_FILE -> Value.CREDENTIAL_ON_FILE
                                MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE
                                CONTACTLESS_MAGNETIC_STRIPE -> Value.CONTACTLESS_MAGNETIC_STRIPE
                                INTEGRATED_CIRCUIT_CARD_NO_CVV ->
                                    Value.INTEGRATED_CIRCUIT_CARD_NO_CVV
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                UNKNOWN -> Known.UNKNOWN
                                MANUAL -> Known.MANUAL
                                MAGNETIC_STRIPE_NO_CVV -> Known.MAGNETIC_STRIPE_NO_CVV
                                OPTICAL_CODE -> Known.OPTICAL_CODE
                                INTEGRATED_CIRCUIT_CARD -> Known.INTEGRATED_CIRCUIT_CARD
                                CONTACTLESS -> Known.CONTACTLESS
                                CREDENTIAL_ON_FILE -> Known.CREDENTIAL_ON_FILE
                                MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE
                                CONTACTLESS_MAGNETIC_STRIPE -> Known.CONTACTLESS_MAGNETIC_STRIPE
                                INTEGRATED_CIRCUIT_CARD_NO_CVV ->
                                    Known.INTEGRATED_CIRCUIT_CARD_NO_CVV
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown PointOfServiceEntryMode: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): PointOfServiceEntryMode = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is PointOfServiceEntryMode && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * Only present when `actioner: network`. Describes why a card authorization was
                     * approved or declined by Visa through stand-in processing.
                     */
                    class StandInProcessingReason
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Increase failed to process the authorization in a timely manner. */
                            @JvmField val ISSUER_ERROR = of("issuer_error")

                            /** The physical card read had an invalid CVV or dCVV. */
                            @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card")

                            /**
                             * The card's authorization request cryptogram was invalid. The
                             * cryptogram can be from a physical card or a Digital Wallet Token
                             * purchase.
                             */
                            @JvmField val INVALID_CRYPTOGRAM = of("invalid_cryptogram")

                            /** The 3DS cardholder authentication verification value was invalid. */
                            @JvmField
                            val INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE =
                                of("invalid_cardholder_authentication_verification_value")

                            /**
                             * An internal Visa error occurred. Visa uses this reason code for
                             * certain expected occurrences as well, such as Application Transaction
                             * Counter (ATC) replays.
                             */
                            @JvmField val INTERNAL_VISA_ERROR = of("internal_visa_error")

                            /**
                             * The merchant has enabled Visa's Transaction Advisory Service and
                             * requires further authentication to perform the transaction. In
                             * practice this is often utilized at fuel pumps to tell the cardholder
                             * to see the cashier.
                             */
                            @JvmField
                            val MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED =
                                of("merchant_transaction_advisory_service_authentication_required")

                            /**
                             * The transaction was blocked by Visa's Payment Fraud Disruption
                             * service due to fraudulent Acquirer behavior, such as card testing.
                             */
                            @JvmField
                            val PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK =
                                of("payment_fraud_disruption_acquirer_block")

                            /** An unspecific reason for stand-in processing. */
                            @JvmField val OTHER = of("other")

                            @JvmStatic
                            fun of(value: String) = StandInProcessingReason(JsonField.of(value))
                        }

                        /** An enum containing [StandInProcessingReason]'s known values. */
                        enum class Known {
                            /** Increase failed to process the authorization in a timely manner. */
                            ISSUER_ERROR,
                            /** The physical card read had an invalid CVV or dCVV. */
                            INVALID_PHYSICAL_CARD,
                            /**
                             * The card's authorization request cryptogram was invalid. The
                             * cryptogram can be from a physical card or a Digital Wallet Token
                             * purchase.
                             */
                            INVALID_CRYPTOGRAM,
                            /** The 3DS cardholder authentication verification value was invalid. */
                            INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE,
                            /**
                             * An internal Visa error occurred. Visa uses this reason code for
                             * certain expected occurrences as well, such as Application Transaction
                             * Counter (ATC) replays.
                             */
                            INTERNAL_VISA_ERROR,
                            /**
                             * The merchant has enabled Visa's Transaction Advisory Service and
                             * requires further authentication to perform the transaction. In
                             * practice this is often utilized at fuel pumps to tell the cardholder
                             * to see the cashier.
                             */
                            MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED,
                            /**
                             * The transaction was blocked by Visa's Payment Fraud Disruption
                             * service due to fraudulent Acquirer behavior, such as card testing.
                             */
                            PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK,
                            /** An unspecific reason for stand-in processing. */
                            OTHER,
                        }

                        /**
                         * An enum containing [StandInProcessingReason]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [StandInProcessingReason] can contain an unknown value in
                         * a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Increase failed to process the authorization in a timely manner. */
                            ISSUER_ERROR,
                            /** The physical card read had an invalid CVV or dCVV. */
                            INVALID_PHYSICAL_CARD,
                            /**
                             * The card's authorization request cryptogram was invalid. The
                             * cryptogram can be from a physical card or a Digital Wallet Token
                             * purchase.
                             */
                            INVALID_CRYPTOGRAM,
                            /** The 3DS cardholder authentication verification value was invalid. */
                            INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE,
                            /**
                             * An internal Visa error occurred. Visa uses this reason code for
                             * certain expected occurrences as well, such as Application Transaction
                             * Counter (ATC) replays.
                             */
                            INTERNAL_VISA_ERROR,
                            /**
                             * The merchant has enabled Visa's Transaction Advisory Service and
                             * requires further authentication to perform the transaction. In
                             * practice this is often utilized at fuel pumps to tell the cardholder
                             * to see the cashier.
                             */
                            MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED,
                            /**
                             * The transaction was blocked by Visa's Payment Fraud Disruption
                             * service due to fraudulent Acquirer behavior, such as card testing.
                             */
                            PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK,
                            /** An unspecific reason for stand-in processing. */
                            OTHER,
                            /**
                             * An enum member indicating that [StandInProcessingReason] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                ISSUER_ERROR -> Value.ISSUER_ERROR
                                INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD
                                INVALID_CRYPTOGRAM -> Value.INVALID_CRYPTOGRAM
                                INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE ->
                                    Value.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE
                                INTERNAL_VISA_ERROR -> Value.INTERNAL_VISA_ERROR
                                MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED ->
                                    Value
                                        .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED
                                PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK ->
                                    Value.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK
                                OTHER -> Value.OTHER
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                ISSUER_ERROR -> Known.ISSUER_ERROR
                                INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD
                                INVALID_CRYPTOGRAM -> Known.INVALID_CRYPTOGRAM
                                INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE ->
                                    Known.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE
                                INTERNAL_VISA_ERROR -> Known.INTERNAL_VISA_ERROR
                                MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED ->
                                    Known
                                        .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED
                                PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK ->
                                    Known.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK
                                OTHER -> Known.OTHER
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown StandInProcessingReason: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): StandInProcessingReason = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is StandInProcessingReason && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * The capability of the terminal being used to read the card. Shows whether a
                     * terminal can e.g., accept chip cards or if it only supports magnetic stripe
                     * reads. This reflects the highest capability of the terminal — for example, a
                     * terminal that supports both chip and magnetic stripe will be identified as
                     * chip-capable.
                     */
                    class TerminalEntryCapability
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Unknown */
                            @JvmField val UNKNOWN = of("unknown")

                            /** No terminal was used for this transaction. */
                            @JvmField val TERMINAL_NOT_USED = of("terminal_not_used")

                            /**
                             * The terminal can only read magnetic stripes and does not have chip or
                             * contactless reading capability.
                             */
                            @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe")

                            /** The terminal can only read barcodes. */
                            @JvmField val BARCODE = of("barcode")

                            /**
                             * The terminal can only read cards via Optical Character Recognition.
                             */
                            @JvmField
                            val OPTICAL_CHARACTER_RECOGNITION = of("optical_character_recognition")

                            /**
                             * The terminal supports contact chip cards and can also read the
                             * magnetic stripe. If contact chip is supported, this value is used
                             * regardless of whether contactless is also supported.
                             */
                            @JvmField val CHIP_OR_CONTACTLESS = of("chip_or_contactless")

                            /**
                             * The terminal supports contactless reads but does not support contact
                             * chip. Only used when the terminal lacks contact chip capability.
                             */
                            @JvmField val CONTACTLESS_ONLY = of("contactless_only")

                            /** The terminal has no card reading capability. */
                            @JvmField val NO_CAPABILITY = of("no_capability")

                            @JvmStatic
                            fun of(value: String) = TerminalEntryCapability(JsonField.of(value))
                        }

                        /** An enum containing [TerminalEntryCapability]'s known values. */
                        enum class Known {
                            /** Unknown */
                            UNKNOWN,
                            /** No terminal was used for this transaction. */
                            TERMINAL_NOT_USED,
                            /**
                             * The terminal can only read magnetic stripes and does not have chip or
                             * contactless reading capability.
                             */
                            MAGNETIC_STRIPE,
                            /** The terminal can only read barcodes. */
                            BARCODE,
                            /**
                             * The terminal can only read cards via Optical Character Recognition.
                             */
                            OPTICAL_CHARACTER_RECOGNITION,
                            /**
                             * The terminal supports contact chip cards and can also read the
                             * magnetic stripe. If contact chip is supported, this value is used
                             * regardless of whether contactless is also supported.
                             */
                            CHIP_OR_CONTACTLESS,
                            /**
                             * The terminal supports contactless reads but does not support contact
                             * chip. Only used when the terminal lacks contact chip capability.
                             */
                            CONTACTLESS_ONLY,
                            /** The terminal has no card reading capability. */
                            NO_CAPABILITY,
                        }

                        /**
                         * An enum containing [TerminalEntryCapability]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [TerminalEntryCapability] can contain an unknown value in
                         * a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Unknown */
                            UNKNOWN,
                            /** No terminal was used for this transaction. */
                            TERMINAL_NOT_USED,
                            /**
                             * The terminal can only read magnetic stripes and does not have chip or
                             * contactless reading capability.
                             */
                            MAGNETIC_STRIPE,
                            /** The terminal can only read barcodes. */
                            BARCODE,
                            /**
                             * The terminal can only read cards via Optical Character Recognition.
                             */
                            OPTICAL_CHARACTER_RECOGNITION,
                            /**
                             * The terminal supports contact chip cards and can also read the
                             * magnetic stripe. If contact chip is supported, this value is used
                             * regardless of whether contactless is also supported.
                             */
                            CHIP_OR_CONTACTLESS,
                            /**
                             * The terminal supports contactless reads but does not support contact
                             * chip. Only used when the terminal lacks contact chip capability.
                             */
                            CONTACTLESS_ONLY,
                            /** The terminal has no card reading capability. */
                            NO_CAPABILITY,
                            /**
                             * An enum member indicating that [TerminalEntryCapability] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                UNKNOWN -> Value.UNKNOWN
                                TERMINAL_NOT_USED -> Value.TERMINAL_NOT_USED
                                MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE
                                BARCODE -> Value.BARCODE
                                OPTICAL_CHARACTER_RECOGNITION -> Value.OPTICAL_CHARACTER_RECOGNITION
                                CHIP_OR_CONTACTLESS -> Value.CHIP_OR_CONTACTLESS
                                CONTACTLESS_ONLY -> Value.CONTACTLESS_ONLY
                                NO_CAPABILITY -> Value.NO_CAPABILITY
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                UNKNOWN -> Known.UNKNOWN
                                TERMINAL_NOT_USED -> Known.TERMINAL_NOT_USED
                                MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE
                                BARCODE -> Known.BARCODE
                                OPTICAL_CHARACTER_RECOGNITION -> Known.OPTICAL_CHARACTER_RECOGNITION
                                CHIP_OR_CONTACTLESS -> Known.CHIP_OR_CONTACTLESS
                                CONTACTLESS_ONLY -> Known.CONTACTLESS_ONLY
                                NO_CAPABILITY -> Known.NO_CAPABILITY
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown TerminalEntryCapability: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): TerminalEntryCapability = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is TerminalEntryCapability && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Visa &&
                            electronicCommerceIndicator == other.electronicCommerceIndicator &&
                            pointOfServiceEntryMode == other.pointOfServiceEntryMode &&
                            standInProcessingReason == other.standInProcessingReason &&
                            terminalEntryCapability == other.terminalEntryCapability &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            electronicCommerceIndicator,
                            pointOfServiceEntryMode,
                            standInProcessingReason,
                            terminalEntryCapability,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Visa{electronicCommerceIndicator=$electronicCommerceIndicator, pointOfServiceEntryMode=$pointOfServiceEntryMode, standInProcessingReason=$standInProcessingReason, terminalEntryCapability=$terminalEntryCapability, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is NetworkDetails &&
                        category == other.category &&
                        pulse == other.pulse &&
                        visa == other.visa &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(category, pulse, visa, additionalProperties)
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "NetworkDetails{category=$category, pulse=$pulse, visa=$visa, additionalProperties=$additionalProperties}"
            }

            /** Network-specific identifiers for a specific request or transaction. */
            class NetworkIdentifiers
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val authorizationIdentificationResponse: JsonField<String>,
                private val retrievalReferenceNumber: JsonField<String>,
                private val traceNumber: JsonField<String>,
                private val transactionId: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("authorization_identification_response")
                    @ExcludeMissing
                    authorizationIdentificationResponse: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("retrieval_reference_number")
                    @ExcludeMissing
                    retrievalReferenceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("trace_number")
                    @ExcludeMissing
                    traceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("transaction_id")
                    @ExcludeMissing
                    transactionId: JsonField<String> = JsonMissing.of(),
                ) : this(
                    authorizationIdentificationResponse,
                    retrievalReferenceNumber,
                    traceNumber,
                    transactionId,
                    mutableMapOf(),
                )

                /**
                 * The randomly generated 6-character Authorization Identification Response code
                 * sent back to the acquirer in an approved response.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun authorizationIdentificationResponse(): Optional<String> =
                    authorizationIdentificationResponse.getOptional(
                        "authorization_identification_response"
                    )

                /**
                 * A life-cycle identifier used across e.g., an authorization and a reversal.
                 * Expected to be unique per acquirer within a window of time. For some card
                 * networks the retrieval reference number includes the trace counter.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun retrievalReferenceNumber(): Optional<String> =
                    retrievalReferenceNumber.getOptional("retrieval_reference_number")

                /**
                 * A counter used to verify an individual authorization. Expected to be unique per
                 * acquirer within a window of time.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun traceNumber(): Optional<String> = traceNumber.getOptional("trace_number")

                /**
                 * A globally unique transaction identifier provided by the card network, used
                 * across multiple life-cycle requests.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun transactionId(): Optional<String> = transactionId.getOptional("transaction_id")

                /**
                 * Returns the raw JSON value of [authorizationIdentificationResponse].
                 *
                 * Unlike [authorizationIdentificationResponse], this method doesn't throw if the
                 * JSON field has an unexpected type.
                 */
                @JsonProperty("authorization_identification_response")
                @ExcludeMissing
                fun _authorizationIdentificationResponse(): JsonField<String> =
                    authorizationIdentificationResponse

                /**
                 * Returns the raw JSON value of [retrievalReferenceNumber].
                 *
                 * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field
                 * has an unexpected type.
                 */
                @JsonProperty("retrieval_reference_number")
                @ExcludeMissing
                fun _retrievalReferenceNumber(): JsonField<String> = retrievalReferenceNumber

                /**
                 * Returns the raw JSON value of [traceNumber].
                 *
                 * Unlike [traceNumber], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("trace_number")
                @ExcludeMissing
                fun _traceNumber(): JsonField<String> = traceNumber

                /**
                 * Returns the raw JSON value of [transactionId].
                 *
                 * Unlike [transactionId], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("transaction_id")
                @ExcludeMissing
                fun _transactionId(): JsonField<String> = transactionId

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of
                     * [NetworkIdentifiers].
                     *
                     * The following fields are required:
                     * ```java
                     * .authorizationIdentificationResponse()
                     * .retrievalReferenceNumber()
                     * .traceNumber()
                     * .transactionId()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [NetworkIdentifiers]. */
                class Builder internal constructor() {

                    private var authorizationIdentificationResponse: JsonField<String>? = null
                    private var retrievalReferenceNumber: JsonField<String>? = null
                    private var traceNumber: JsonField<String>? = null
                    private var transactionId: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(networkIdentifiers: NetworkIdentifiers) = apply {
                        authorizationIdentificationResponse =
                            networkIdentifiers.authorizationIdentificationResponse
                        retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber
                        traceNumber = networkIdentifiers.traceNumber
                        transactionId = networkIdentifiers.transactionId
                        additionalProperties =
                            networkIdentifiers.additionalProperties.toMutableMap()
                    }

                    /**
                     * The randomly generated 6-character Authorization Identification Response code
                     * sent back to the acquirer in an approved response.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: String?
                    ) =
                        authorizationIdentificationResponse(
                            JsonField.ofNullable(authorizationIdentificationResponse)
                        )

                    /**
                     * Alias for calling [Builder.authorizationIdentificationResponse] with
                     * `authorizationIdentificationResponse.orElse(null)`.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: Optional<String>
                    ) =
                        authorizationIdentificationResponse(
                            authorizationIdentificationResponse.getOrNull()
                        )

                    /**
                     * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON
                     * value.
                     *
                     * You should usually call [Builder.authorizationIdentificationResponse] with a
                     * well-typed [String] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: JsonField<String>
                    ) = apply {
                        this.authorizationIdentificationResponse =
                            authorizationIdentificationResponse
                    }

                    /**
                     * A life-cycle identifier used across e.g., an authorization and a reversal.
                     * Expected to be unique per acquirer within a window of time. For some card
                     * networks the retrieval reference number includes the trace counter.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: String?) =
                        retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber))

                    /**
                     * Alias for calling [Builder.retrievalReferenceNumber] with
                     * `retrievalReferenceNumber.orElse(null)`.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: Optional<String>) =
                        retrievalReferenceNumber(retrievalReferenceNumber.getOrNull())

                    /**
                     * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.retrievalReferenceNumber] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField<String>) =
                        apply {
                            this.retrievalReferenceNumber = retrievalReferenceNumber
                        }

                    /**
                     * A counter used to verify an individual authorization. Expected to be unique
                     * per acquirer within a window of time.
                     */
                    fun traceNumber(traceNumber: String?) =
                        traceNumber(JsonField.ofNullable(traceNumber))

                    /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */
                    fun traceNumber(traceNumber: Optional<String>) =
                        traceNumber(traceNumber.getOrNull())

                    /**
                     * Sets [Builder.traceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.traceNumber] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun traceNumber(traceNumber: JsonField<String>) = apply {
                        this.traceNumber = traceNumber
                    }

                    /**
                     * A globally unique transaction identifier provided by the card network, used
                     * across multiple life-cycle requests.
                     */
                    fun transactionId(transactionId: String?) =
                        transactionId(JsonField.ofNullable(transactionId))

                    /**
                     * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`.
                     */
                    fun transactionId(transactionId: Optional<String>) =
                        transactionId(transactionId.getOrNull())

                    /**
                     * Sets [Builder.transactionId] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.transactionId] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun transactionId(transactionId: JsonField<String>) = apply {
                        this.transactionId = transactionId
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [NetworkIdentifiers].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .authorizationIdentificationResponse()
                     * .retrievalReferenceNumber()
                     * .traceNumber()
                     * .transactionId()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): NetworkIdentifiers =
                        NetworkIdentifiers(
                            checkRequired(
                                "authorizationIdentificationResponse",
                                authorizationIdentificationResponse,
                            ),
                            checkRequired("retrievalReferenceNumber", retrievalReferenceNumber),
                            checkRequired("traceNumber", traceNumber),
                            checkRequired("transactionId", transactionId),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): NetworkIdentifiers = apply {
                    if (validated) {
                        return@apply
                    }

                    authorizationIdentificationResponse()
                    retrievalReferenceNumber()
                    traceNumber()
                    transactionId()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) +
                        (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) +
                        (if (traceNumber.asKnown().isPresent) 1 else 0) +
                        (if (transactionId.asKnown().isPresent) 1 else 0)

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is NetworkIdentifiers &&
                        authorizationIdentificationResponse ==
                            other.authorizationIdentificationResponse &&
                        retrievalReferenceNumber == other.retrievalReferenceNumber &&
                        traceNumber == other.traceNumber &&
                        transactionId == other.transactionId &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        authorizationIdentificationResponse,
                        retrievalReferenceNumber,
                        traceNumber,
                        transactionId,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}"
            }

            class SchemeFee
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val amount: JsonField<String>,
                private val createdAt: JsonField<OffsetDateTime>,
                private val currency: JsonField<Currency>,
                private val feeType: JsonField<FeeType>,
                private val fixedComponent: JsonField<String>,
                private val variableRate: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("amount")
                    @ExcludeMissing
                    amount: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("created_at")
                    @ExcludeMissing
                    createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                    @JsonProperty("currency")
                    @ExcludeMissing
                    currency: JsonField<Currency> = JsonMissing.of(),
                    @JsonProperty("fee_type")
                    @ExcludeMissing
                    feeType: JsonField<FeeType> = JsonMissing.of(),
                    @JsonProperty("fixed_component")
                    @ExcludeMissing
                    fixedComponent: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("variable_rate")
                    @ExcludeMissing
                    variableRate: JsonField<String> = JsonMissing.of(),
                ) : this(
                    amount,
                    createdAt,
                    currency,
                    feeType,
                    fixedComponent,
                    variableRate,
                    mutableMapOf(),
                )

                /**
                 * The fee amount given as a string containing a decimal number.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun amount(): String = amount.getRequired("amount")

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was
                 * created.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /**
                 * The type of fee being assessed.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun feeType(): FeeType = feeType.getRequired("fee_type")

                /**
                 * The fixed component of the fee, if applicable, given in major units of the fee
                 * amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun fixedComponent(): Optional<String> =
                    fixedComponent.getOptional("fixed_component")

                /**
                 * The variable rate component of the fee, if applicable, given as a decimal (e.g.,
                 * 0.015 for 1.5%).
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun variableRate(): Optional<String> = variableRate.getOptional("variable_rate")

                /**
                 * Returns the raw JSON value of [amount].
                 *
                 * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<String> = amount

                /**
                 * Returns the raw JSON value of [createdAt].
                 *
                 * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("created_at")
                @ExcludeMissing
                fun _createdAt(): JsonField<OffsetDateTime> = createdAt

                /**
                 * Returns the raw JSON value of [currency].
                 *
                 * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun _currency(): JsonField<Currency> = currency

                /**
                 * Returns the raw JSON value of [feeType].
                 *
                 * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("fee_type")
                @ExcludeMissing
                fun _feeType(): JsonField<FeeType> = feeType

                /**
                 * Returns the raw JSON value of [fixedComponent].
                 *
                 * Unlike [fixedComponent], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("fixed_component")
                @ExcludeMissing
                fun _fixedComponent(): JsonField<String> = fixedComponent

                /**
                 * Returns the raw JSON value of [variableRate].
                 *
                 * Unlike [variableRate], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("variable_rate")
                @ExcludeMissing
                fun _variableRate(): JsonField<String> = variableRate

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [SchemeFee].
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [SchemeFee]. */
                class Builder internal constructor() {

                    private var amount: JsonField<String>? = null
                    private var createdAt: JsonField<OffsetDateTime>? = null
                    private var currency: JsonField<Currency>? = null
                    private var feeType: JsonField<FeeType>? = null
                    private var fixedComponent: JsonField<String>? = null
                    private var variableRate: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(schemeFee: SchemeFee) = apply {
                        amount = schemeFee.amount
                        createdAt = schemeFee.createdAt
                        currency = schemeFee.currency
                        feeType = schemeFee.feeType
                        fixedComponent = schemeFee.fixedComponent
                        variableRate = schemeFee.variableRate
                        additionalProperties = schemeFee.additionalProperties.toMutableMap()
                    }

                    /** The fee amount given as a string containing a decimal number. */
                    fun amount(amount: String) = amount(JsonField.of(amount))

                    /**
                     * Sets [Builder.amount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.amount] with a well-typed [String] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun amount(amount: JsonField<String>) = apply { this.amount = amount }

                    /**
                     * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee
                     * was created.
                     */
                    fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt))

                    /**
                     * Sets [Builder.createdAt] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.createdAt] with a well-typed
                     * [OffsetDateTime] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply {
                        this.createdAt = createdAt
                    }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                     * reimbursement.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * Sets [Builder.currency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.currency] with a well-typed [Currency] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                    /** The type of fee being assessed. */
                    fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType))

                    /**
                     * Sets [Builder.feeType] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.feeType] with a well-typed [FeeType] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun feeType(feeType: JsonField<FeeType>) = apply { this.feeType = feeType }

                    /**
                     * The fixed component of the fee, if applicable, given in major units of the
                     * fee amount.
                     */
                    fun fixedComponent(fixedComponent: String?) =
                        fixedComponent(JsonField.ofNullable(fixedComponent))

                    /**
                     * Alias for calling [Builder.fixedComponent] with
                     * `fixedComponent.orElse(null)`.
                     */
                    fun fixedComponent(fixedComponent: Optional<String>) =
                        fixedComponent(fixedComponent.getOrNull())

                    /**
                     * Sets [Builder.fixedComponent] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.fixedComponent] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun fixedComponent(fixedComponent: JsonField<String>) = apply {
                        this.fixedComponent = fixedComponent
                    }

                    /**
                     * The variable rate component of the fee, if applicable, given as a decimal
                     * (e.g., 0.015 for 1.5%).
                     */
                    fun variableRate(variableRate: String?) =
                        variableRate(JsonField.ofNullable(variableRate))

                    /**
                     * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`.
                     */
                    fun variableRate(variableRate: Optional<String>) =
                        variableRate(variableRate.getOrNull())

                    /**
                     * Sets [Builder.variableRate] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.variableRate] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun variableRate(variableRate: JsonField<String>) = apply {
                        this.variableRate = variableRate
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [SchemeFee].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): SchemeFee =
                        SchemeFee(
                            checkRequired("amount", amount),
                            checkRequired("createdAt", createdAt),
                            checkRequired("currency", currency),
                            checkRequired("feeType", feeType),
                            checkRequired("fixedComponent", fixedComponent),
                            checkRequired("variableRate", variableRate),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): SchemeFee = apply {
                    if (validated) {
                        return@apply
                    }

                    amount()
                    createdAt()
                    currency().validate()
                    feeType().validate()
                    fixedComponent()
                    variableRate()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (amount.asKnown().isPresent) 1 else 0) +
                        (if (createdAt.asKnown().isPresent) 1 else 0) +
                        (currency.asKnown().getOrNull()?.validity() ?: 0) +
                        (feeType.asKnown().getOrNull()?.validity() ?: 0) +
                        (if (fixedComponent.asKnown().isPresent) 1 else 0) +
                        (if (variableRate.asKnown().isPresent) 1 else 0)

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 */
                class Currency
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** US Dollar (USD) */
                        @JvmField val USD = of("USD")

                        @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                    }

                    /** An enum containing [Currency]'s known values. */
                    enum class Known {
                        /** US Dollar (USD) */
                        USD
                    }

                    /**
                     * An enum containing [Currency]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Currency] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** US Dollar (USD) */
                        USD,
                        /**
                         * An enum member indicating that [Currency] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            USD -> Value.USD
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            USD -> Known.USD
                            else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Currency = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Currency && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** The type of fee being assessed. */
                class FeeType
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY =
                            of("visa_international_service_assessment_single_currency")

                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY =
                            of("visa_international_service_assessment_cross_currency")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE =
                            of("visa_authorization_domestic_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_international_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE =
                            of("visa_authorization_canada_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_international_point_of_sale")

                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE =
                            of("visa_authorization_address_verification_service")

                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        @JvmField
                        val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization")

                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission")

                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_DOMESTIC =
                            of("visa_account_verification_domestic")

                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL =
                            of("visa_account_verification_international")

                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_CANADA =
                            of("visa_account_verification_canada")

                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee")

                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        @JvmField
                        val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE =
                            of("visa_consumer_debit_acceptance_fee")

                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        @JvmField
                        val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE =
                            of("visa_business_debit_acceptance_fee")

                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee")

                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic")

                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        @JvmField
                        val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international")

                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token")

                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token")

                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission")

                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization")

                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        @JvmField
                        val VISA_DIRECT_TRANSACTION_DOMESTIC =
                            of("visa_direct_transaction_domestic")

                        /** Issuer card service fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit")

                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT =
                            of("visa_advertising_service_commercial_credit")

                        /** Issuer Community Growth Acceleration Program Fee. */
                        @JvmField
                        val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM =
                            of("visa_community_growth_acceleration_program")

                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        @JvmField
                        val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT =
                            of("visa_processing_guarantee_commercial_credit")

                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee")

                        @JvmStatic fun of(value: String) = FeeType(JsonField.of(value))
                    }

                    /** An enum containing [FeeType]'s known values. */
                    enum class Known {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                    }

                    /**
                     * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member.
                     *
                     * An instance of [FeeType] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                        /**
                         * An enum member indicating that [FeeType] was instantiated with an unknown
                         * value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Value.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Value.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Known.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Known.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE
                            else -> throw IncreaseInvalidDataException("Unknown FeeType: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): FeeType = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is FeeType && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is SchemeFee &&
                        amount == other.amount &&
                        createdAt == other.createdAt &&
                        currency == other.currency &&
                        feeType == other.feeType &&
                        fixedComponent == other.fixedComponent &&
                        variableRate == other.variableRate &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        amount,
                        createdAt,
                        currency,
                        feeType,
                        fixedComponent,
                        variableRate,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}"
            }

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_balance_inquiry`.
             */
            class Type @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    @JvmField val CARD_BALANCE_INQUIRY = of("card_balance_inquiry")

                    @JvmStatic fun of(value: String) = Type(JsonField.of(value))
                }

                /** An enum containing [Type]'s known values. */
                enum class Known {
                    CARD_BALANCE_INQUIRY
                }

                /**
                 * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Type] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    CARD_BALANCE_INQUIRY,
                    /**
                     * An enum member indicating that [Type] was instantiated with an unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        CARD_BALANCE_INQUIRY -> Value.CARD_BALANCE_INQUIRY
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        CARD_BALANCE_INQUIRY -> Known.CARD_BALANCE_INQUIRY
                        else -> throw IncreaseInvalidDataException("Unknown Type: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Type = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Type && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** Fields related to verification of cardholder-provided values. */
            class Verification
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val cardVerificationCode: JsonField<CardVerificationCode>,
                private val cardholderAddress: JsonField<CardholderAddress>,
                private val cardholderName: JsonField<CardholderName>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("card_verification_code")
                    @ExcludeMissing
                    cardVerificationCode: JsonField<CardVerificationCode> = JsonMissing.of(),
                    @JsonProperty("cardholder_address")
                    @ExcludeMissing
                    cardholderAddress: JsonField<CardholderAddress> = JsonMissing.of(),
                    @JsonProperty("cardholder_name")
                    @ExcludeMissing
                    cardholderName: JsonField<CardholderName> = JsonMissing.of(),
                ) : this(cardVerificationCode, cardholderAddress, cardholderName, mutableMapOf())

                /**
                 * Fields related to verification of the Card Verification Code, a 3-digit code on
                 * the back of the card.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun cardVerificationCode(): CardVerificationCode =
                    cardVerificationCode.getRequired("card_verification_code")

                /**
                 * Cardholder address provided in the authorization request and the address on file
                 * we verified it against.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun cardholderAddress(): CardholderAddress =
                    cardholderAddress.getRequired("cardholder_address")

                /**
                 * Cardholder name provided in the authorization request.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun cardholderName(): Optional<CardholderName> =
                    cardholderName.getOptional("cardholder_name")

                /**
                 * Returns the raw JSON value of [cardVerificationCode].
                 *
                 * Unlike [cardVerificationCode], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("card_verification_code")
                @ExcludeMissing
                fun _cardVerificationCode(): JsonField<CardVerificationCode> = cardVerificationCode

                /**
                 * Returns the raw JSON value of [cardholderAddress].
                 *
                 * Unlike [cardholderAddress], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("cardholder_address")
                @ExcludeMissing
                fun _cardholderAddress(): JsonField<CardholderAddress> = cardholderAddress

                /**
                 * Returns the raw JSON value of [cardholderName].
                 *
                 * Unlike [cardholderName], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("cardholder_name")
                @ExcludeMissing
                fun _cardholderName(): JsonField<CardholderName> = cardholderName

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [Verification].
                     *
                     * The following fields are required:
                     * ```java
                     * .cardVerificationCode()
                     * .cardholderAddress()
                     * .cardholderName()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [Verification]. */
                class Builder internal constructor() {

                    private var cardVerificationCode: JsonField<CardVerificationCode>? = null
                    private var cardholderAddress: JsonField<CardholderAddress>? = null
                    private var cardholderName: JsonField<CardholderName>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(verification: Verification) = apply {
                        cardVerificationCode = verification.cardVerificationCode
                        cardholderAddress = verification.cardholderAddress
                        cardholderName = verification.cardholderName
                        additionalProperties = verification.additionalProperties.toMutableMap()
                    }

                    /**
                     * Fields related to verification of the Card Verification Code, a 3-digit code
                     * on the back of the card.
                     */
                    fun cardVerificationCode(cardVerificationCode: CardVerificationCode) =
                        cardVerificationCode(JsonField.of(cardVerificationCode))

                    /**
                     * Sets [Builder.cardVerificationCode] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.cardVerificationCode] with a well-typed
                     * [CardVerificationCode] value instead. This method is primarily for setting
                     * the field to an undocumented or not yet supported value.
                     */
                    fun cardVerificationCode(
                        cardVerificationCode: JsonField<CardVerificationCode>
                    ) = apply { this.cardVerificationCode = cardVerificationCode }

                    /**
                     * Cardholder address provided in the authorization request and the address on
                     * file we verified it against.
                     */
                    fun cardholderAddress(cardholderAddress: CardholderAddress) =
                        cardholderAddress(JsonField.of(cardholderAddress))

                    /**
                     * Sets [Builder.cardholderAddress] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.cardholderAddress] with a well-typed
                     * [CardholderAddress] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun cardholderAddress(cardholderAddress: JsonField<CardholderAddress>) = apply {
                        this.cardholderAddress = cardholderAddress
                    }

                    /** Cardholder name provided in the authorization request. */
                    fun cardholderName(cardholderName: CardholderName?) =
                        cardholderName(JsonField.ofNullable(cardholderName))

                    /**
                     * Alias for calling [Builder.cardholderName] with
                     * `cardholderName.orElse(null)`.
                     */
                    fun cardholderName(cardholderName: Optional<CardholderName>) =
                        cardholderName(cardholderName.getOrNull())

                    /**
                     * Sets [Builder.cardholderName] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.cardholderName] with a well-typed
                     * [CardholderName] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun cardholderName(cardholderName: JsonField<CardholderName>) = apply {
                        this.cardholderName = cardholderName
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [Verification].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .cardVerificationCode()
                     * .cardholderAddress()
                     * .cardholderName()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): Verification =
                        Verification(
                            checkRequired("cardVerificationCode", cardVerificationCode),
                            checkRequired("cardholderAddress", cardholderAddress),
                            checkRequired("cardholderName", cardholderName),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Verification = apply {
                    if (validated) {
                        return@apply
                    }

                    cardVerificationCode().validate()
                    cardholderAddress().validate()
                    cardholderName().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (cardVerificationCode.asKnown().getOrNull()?.validity() ?: 0) +
                        (cardholderAddress.asKnown().getOrNull()?.validity() ?: 0) +
                        (cardholderName.asKnown().getOrNull()?.validity() ?: 0)

                /**
                 * Fields related to verification of the Card Verification Code, a 3-digit code on
                 * the back of the card.
                 */
                class CardVerificationCode
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val result: JsonField<Result>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("result")
                        @ExcludeMissing
                        result: JsonField<Result> = JsonMissing.of()
                    ) : this(result, mutableMapOf())

                    /**
                     * The result of verifying the Card Verification Code.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun result(): Result = result.getRequired("result")

                    /**
                     * Returns the raw JSON value of [result].
                     *
                     * Unlike [result], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("result")
                    @ExcludeMissing
                    fun _result(): JsonField<Result> = result

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [CardVerificationCode].
                         *
                         * The following fields are required:
                         * ```java
                         * .result()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CardVerificationCode]. */
                    class Builder internal constructor() {

                        private var result: JsonField<Result>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(cardVerificationCode: CardVerificationCode) = apply {
                            result = cardVerificationCode.result
                            additionalProperties =
                                cardVerificationCode.additionalProperties.toMutableMap()
                        }

                        /** The result of verifying the Card Verification Code. */
                        fun result(result: Result) = result(JsonField.of(result))

                        /**
                         * Sets [Builder.result] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.result] with a well-typed [Result] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun result(result: JsonField<Result>) = apply { this.result = result }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CardVerificationCode].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .result()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CardVerificationCode =
                            CardVerificationCode(
                                checkRequired("result", result),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CardVerificationCode = apply {
                        if (validated) {
                            return@apply
                        }

                        result().validate()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0)

                    /** The result of verifying the Card Verification Code. */
                    class Result
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /**
                             * No card verification code was provided in the authorization request.
                             */
                            @JvmField val NOT_CHECKED = of("not_checked")

                            /** The card verification code matched the one on file. */
                            @JvmField val MATCH = of("match")

                            /** The card verification code did not match the one on file. */
                            @JvmField val NO_MATCH = of("no_match")

                            @JvmStatic fun of(value: String) = Result(JsonField.of(value))
                        }

                        /** An enum containing [Result]'s known values. */
                        enum class Known {
                            /**
                             * No card verification code was provided in the authorization request.
                             */
                            NOT_CHECKED,
                            /** The card verification code matched the one on file. */
                            MATCH,
                            /** The card verification code did not match the one on file. */
                            NO_MATCH,
                        }

                        /**
                         * An enum containing [Result]'s known values, as well as an [_UNKNOWN]
                         * member.
                         *
                         * An instance of [Result] can contain an unknown value in a couple of
                         * cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /**
                             * No card verification code was provided in the authorization request.
                             */
                            NOT_CHECKED,
                            /** The card verification code matched the one on file. */
                            MATCH,
                            /** The card verification code did not match the one on file. */
                            NO_MATCH,
                            /**
                             * An enum member indicating that [Result] was instantiated with an
                             * unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NOT_CHECKED -> Value.NOT_CHECKED
                                MATCH -> Value.MATCH
                                NO_MATCH -> Value.NO_MATCH
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NOT_CHECKED -> Known.NOT_CHECKED
                                MATCH -> Known.MATCH
                                NO_MATCH -> Known.NO_MATCH
                                else -> throw IncreaseInvalidDataException("Unknown Result: $value")
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): Result = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is Result && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CardVerificationCode &&
                            result == other.result &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}"
                }

                /**
                 * Cardholder address provided in the authorization request and the address on file
                 * we verified it against.
                 */
                class CardholderAddress
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val actualLine1: JsonField<String>,
                    private val actualPostalCode: JsonField<String>,
                    private val providedLine1: JsonField<String>,
                    private val providedPostalCode: JsonField<String>,
                    private val result: JsonField<Result>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("actual_line1")
                        @ExcludeMissing
                        actualLine1: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("actual_postal_code")
                        @ExcludeMissing
                        actualPostalCode: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_line1")
                        @ExcludeMissing
                        providedLine1: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_postal_code")
                        @ExcludeMissing
                        providedPostalCode: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("result")
                        @ExcludeMissing
                        result: JsonField<Result> = JsonMissing.of(),
                    ) : this(
                        actualLine1,
                        actualPostalCode,
                        providedLine1,
                        providedPostalCode,
                        result,
                        mutableMapOf(),
                    )

                    /**
                     * Line 1 of the address on file for the cardholder.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun actualLine1(): Optional<String> = actualLine1.getOptional("actual_line1")

                    /**
                     * The postal code of the address on file for the cardholder.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun actualPostalCode(): Optional<String> =
                        actualPostalCode.getOptional("actual_postal_code")

                    /**
                     * The cardholder address line 1 provided for verification in the authorization
                     * request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedLine1(): Optional<String> =
                        providedLine1.getOptional("provided_line1")

                    /**
                     * The postal code provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedPostalCode(): Optional<String> =
                        providedPostalCode.getOptional("provided_postal_code")

                    /**
                     * The address verification result returned to the card network.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun result(): Result = result.getRequired("result")

                    /**
                     * Returns the raw JSON value of [actualLine1].
                     *
                     * Unlike [actualLine1], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("actual_line1")
                    @ExcludeMissing
                    fun _actualLine1(): JsonField<String> = actualLine1

                    /**
                     * Returns the raw JSON value of [actualPostalCode].
                     *
                     * Unlike [actualPostalCode], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("actual_postal_code")
                    @ExcludeMissing
                    fun _actualPostalCode(): JsonField<String> = actualPostalCode

                    /**
                     * Returns the raw JSON value of [providedLine1].
                     *
                     * Unlike [providedLine1], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("provided_line1")
                    @ExcludeMissing
                    fun _providedLine1(): JsonField<String> = providedLine1

                    /**
                     * Returns the raw JSON value of [providedPostalCode].
                     *
                     * Unlike [providedPostalCode], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("provided_postal_code")
                    @ExcludeMissing
                    fun _providedPostalCode(): JsonField<String> = providedPostalCode

                    /**
                     * Returns the raw JSON value of [result].
                     *
                     * Unlike [result], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("result")
                    @ExcludeMissing
                    fun _result(): JsonField<Result> = result

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [CardholderAddress].
                         *
                         * The following fields are required:
                         * ```java
                         * .actualLine1()
                         * .actualPostalCode()
                         * .providedLine1()
                         * .providedPostalCode()
                         * .result()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CardholderAddress]. */
                    class Builder internal constructor() {

                        private var actualLine1: JsonField<String>? = null
                        private var actualPostalCode: JsonField<String>? = null
                        private var providedLine1: JsonField<String>? = null
                        private var providedPostalCode: JsonField<String>? = null
                        private var result: JsonField<Result>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(cardholderAddress: CardholderAddress) = apply {
                            actualLine1 = cardholderAddress.actualLine1
                            actualPostalCode = cardholderAddress.actualPostalCode
                            providedLine1 = cardholderAddress.providedLine1
                            providedPostalCode = cardholderAddress.providedPostalCode
                            result = cardholderAddress.result
                            additionalProperties =
                                cardholderAddress.additionalProperties.toMutableMap()
                        }

                        /** Line 1 of the address on file for the cardholder. */
                        fun actualLine1(actualLine1: String?) =
                            actualLine1(JsonField.ofNullable(actualLine1))

                        /**
                         * Alias for calling [Builder.actualLine1] with `actualLine1.orElse(null)`.
                         */
                        fun actualLine1(actualLine1: Optional<String>) =
                            actualLine1(actualLine1.getOrNull())

                        /**
                         * Sets [Builder.actualLine1] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.actualLine1] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun actualLine1(actualLine1: JsonField<String>) = apply {
                            this.actualLine1 = actualLine1
                        }

                        /** The postal code of the address on file for the cardholder. */
                        fun actualPostalCode(actualPostalCode: String?) =
                            actualPostalCode(JsonField.ofNullable(actualPostalCode))

                        /**
                         * Alias for calling [Builder.actualPostalCode] with
                         * `actualPostalCode.orElse(null)`.
                         */
                        fun actualPostalCode(actualPostalCode: Optional<String>) =
                            actualPostalCode(actualPostalCode.getOrNull())

                        /**
                         * Sets [Builder.actualPostalCode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.actualPostalCode] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun actualPostalCode(actualPostalCode: JsonField<String>) = apply {
                            this.actualPostalCode = actualPostalCode
                        }

                        /**
                         * The cardholder address line 1 provided for verification in the
                         * authorization request.
                         */
                        fun providedLine1(providedLine1: String?) =
                            providedLine1(JsonField.ofNullable(providedLine1))

                        /**
                         * Alias for calling [Builder.providedLine1] with
                         * `providedLine1.orElse(null)`.
                         */
                        fun providedLine1(providedLine1: Optional<String>) =
                            providedLine1(providedLine1.getOrNull())

                        /**
                         * Sets [Builder.providedLine1] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedLine1] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedLine1(providedLine1: JsonField<String>) = apply {
                            this.providedLine1 = providedLine1
                        }

                        /**
                         * The postal code provided for verification in the authorization request.
                         */
                        fun providedPostalCode(providedPostalCode: String?) =
                            providedPostalCode(JsonField.ofNullable(providedPostalCode))

                        /**
                         * Alias for calling [Builder.providedPostalCode] with
                         * `providedPostalCode.orElse(null)`.
                         */
                        fun providedPostalCode(providedPostalCode: Optional<String>) =
                            providedPostalCode(providedPostalCode.getOrNull())

                        /**
                         * Sets [Builder.providedPostalCode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedPostalCode] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedPostalCode(providedPostalCode: JsonField<String>) = apply {
                            this.providedPostalCode = providedPostalCode
                        }

                        /** The address verification result returned to the card network. */
                        fun result(result: Result) = result(JsonField.of(result))

                        /**
                         * Sets [Builder.result] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.result] with a well-typed [Result] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun result(result: JsonField<Result>) = apply { this.result = result }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CardholderAddress].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .actualLine1()
                         * .actualPostalCode()
                         * .providedLine1()
                         * .providedPostalCode()
                         * .result()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CardholderAddress =
                            CardholderAddress(
                                checkRequired("actualLine1", actualLine1),
                                checkRequired("actualPostalCode", actualPostalCode),
                                checkRequired("providedLine1", providedLine1),
                                checkRequired("providedPostalCode", providedPostalCode),
                                checkRequired("result", result),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CardholderAddress = apply {
                        if (validated) {
                            return@apply
                        }

                        actualLine1()
                        actualPostalCode()
                        providedLine1()
                        providedPostalCode()
                        result().validate()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (actualLine1.asKnown().isPresent) 1 else 0) +
                            (if (actualPostalCode.asKnown().isPresent) 1 else 0) +
                            (if (providedLine1.asKnown().isPresent) 1 else 0) +
                            (if (providedPostalCode.asKnown().isPresent) 1 else 0) +
                            (result.asKnown().getOrNull()?.validity() ?: 0)

                    /** The address verification result returned to the card network. */
                    class Result
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** No address information was provided in the authorization request. */
                            @JvmField val NOT_CHECKED = of("not_checked")

                            /**
                             * Postal code matches, but the street address does not match or was not
                             * provided.
                             */
                            @JvmField
                            val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH =
                                of("postal_code_match_address_no_match")

                            /**
                             * Postal code does not match, but the street address matches or was not
                             * provided.
                             */
                            @JvmField
                            val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH =
                                of("postal_code_no_match_address_match")

                            /** Postal code and street address match. */
                            @JvmField val MATCH = of("match")

                            /** Postal code and street address do not match. */
                            @JvmField val NO_MATCH = of("no_match")

                            /**
                             * Postal code matches, but the street address was not verified.
                             * (deprecated)
                             */
                            @JvmField
                            val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED =
                                of("postal_code_match_address_not_checked")

                            @JvmStatic fun of(value: String) = Result(JsonField.of(value))
                        }

                        /** An enum containing [Result]'s known values. */
                        enum class Known {
                            /** No address information was provided in the authorization request. */
                            NOT_CHECKED,
                            /**
                             * Postal code matches, but the street address does not match or was not
                             * provided.
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NO_MATCH,
                            /**
                             * Postal code does not match, but the street address matches or was not
                             * provided.
                             */
                            POSTAL_CODE_NO_MATCH_ADDRESS_MATCH,
                            /** Postal code and street address match. */
                            MATCH,
                            /** Postal code and street address do not match. */
                            NO_MATCH,
                            /**
                             * Postal code matches, but the street address was not verified.
                             * (deprecated)
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED,
                        }

                        /**
                         * An enum containing [Result]'s known values, as well as an [_UNKNOWN]
                         * member.
                         *
                         * An instance of [Result] can contain an unknown value in a couple of
                         * cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** No address information was provided in the authorization request. */
                            NOT_CHECKED,
                            /**
                             * Postal code matches, but the street address does not match or was not
                             * provided.
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NO_MATCH,
                            /**
                             * Postal code does not match, but the street address matches or was not
                             * provided.
                             */
                            POSTAL_CODE_NO_MATCH_ADDRESS_MATCH,
                            /** Postal code and street address match. */
                            MATCH,
                            /** Postal code and street address do not match. */
                            NO_MATCH,
                            /**
                             * Postal code matches, but the street address was not verified.
                             * (deprecated)
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED,
                            /**
                             * An enum member indicating that [Result] was instantiated with an
                             * unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NOT_CHECKED -> Value.NOT_CHECKED
                                POSTAL_CODE_MATCH_ADDRESS_NO_MATCH ->
                                    Value.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH
                                POSTAL_CODE_NO_MATCH_ADDRESS_MATCH ->
                                    Value.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH
                                MATCH -> Value.MATCH
                                NO_MATCH -> Value.NO_MATCH
                                POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED ->
                                    Value.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NOT_CHECKED -> Known.NOT_CHECKED
                                POSTAL_CODE_MATCH_ADDRESS_NO_MATCH ->
                                    Known.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH
                                POSTAL_CODE_NO_MATCH_ADDRESS_MATCH ->
                                    Known.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH
                                MATCH -> Known.MATCH
                                NO_MATCH -> Known.NO_MATCH
                                POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED ->
                                    Known.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED
                                else -> throw IncreaseInvalidDataException("Unknown Result: $value")
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): Result = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is Result && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CardholderAddress &&
                            actualLine1 == other.actualLine1 &&
                            actualPostalCode == other.actualPostalCode &&
                            providedLine1 == other.providedLine1 &&
                            providedPostalCode == other.providedPostalCode &&
                            result == other.result &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            actualLine1,
                            actualPostalCode,
                            providedLine1,
                            providedPostalCode,
                            result,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}"
                }

                /** Cardholder name provided in the authorization request. */
                class CardholderName
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val providedFirstName: JsonField<String>,
                    private val providedLastName: JsonField<String>,
                    private val providedMiddleName: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("provided_first_name")
                        @ExcludeMissing
                        providedFirstName: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_last_name")
                        @ExcludeMissing
                        providedLastName: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_middle_name")
                        @ExcludeMissing
                        providedMiddleName: JsonField<String> = JsonMissing.of(),
                    ) : this(
                        providedFirstName,
                        providedLastName,
                        providedMiddleName,
                        mutableMapOf(),
                    )

                    /**
                     * The first name provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedFirstName(): Optional<String> =
                        providedFirstName.getOptional("provided_first_name")

                    /**
                     * The last name provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedLastName(): Optional<String> =
                        providedLastName.getOptional("provided_last_name")

                    /**
                     * The middle name provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedMiddleName(): Optional<String> =
                        providedMiddleName.getOptional("provided_middle_name")

                    /**
                     * Returns the raw JSON value of [providedFirstName].
                     *
                     * Unlike [providedFirstName], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("provided_first_name")
                    @ExcludeMissing
                    fun _providedFirstName(): JsonField<String> = providedFirstName

                    /**
                     * Returns the raw JSON value of [providedLastName].
                     *
                     * Unlike [providedLastName], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("provided_last_name")
                    @ExcludeMissing
                    fun _providedLastName(): JsonField<String> = providedLastName

                    /**
                     * Returns the raw JSON value of [providedMiddleName].
                     *
                     * Unlike [providedMiddleName], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("provided_middle_name")
                    @ExcludeMissing
                    fun _providedMiddleName(): JsonField<String> = providedMiddleName

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [CardholderName].
                         *
                         * The following fields are required:
                         * ```java
                         * .providedFirstName()
                         * .providedLastName()
                         * .providedMiddleName()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CardholderName]. */
                    class Builder internal constructor() {

                        private var providedFirstName: JsonField<String>? = null
                        private var providedLastName: JsonField<String>? = null
                        private var providedMiddleName: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(cardholderName: CardholderName) = apply {
                            providedFirstName = cardholderName.providedFirstName
                            providedLastName = cardholderName.providedLastName
                            providedMiddleName = cardholderName.providedMiddleName
                            additionalProperties =
                                cardholderName.additionalProperties.toMutableMap()
                        }

                        /**
                         * The first name provided for verification in the authorization request.
                         */
                        fun providedFirstName(providedFirstName: String?) =
                            providedFirstName(JsonField.ofNullable(providedFirstName))

                        /**
                         * Alias for calling [Builder.providedFirstName] with
                         * `providedFirstName.orElse(null)`.
                         */
                        fun providedFirstName(providedFirstName: Optional<String>) =
                            providedFirstName(providedFirstName.getOrNull())

                        /**
                         * Sets [Builder.providedFirstName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedFirstName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedFirstName(providedFirstName: JsonField<String>) = apply {
                            this.providedFirstName = providedFirstName
                        }

                        /** The last name provided for verification in the authorization request. */
                        fun providedLastName(providedLastName: String?) =
                            providedLastName(JsonField.ofNullable(providedLastName))

                        /**
                         * Alias for calling [Builder.providedLastName] with
                         * `providedLastName.orElse(null)`.
                         */
                        fun providedLastName(providedLastName: Optional<String>) =
                            providedLastName(providedLastName.getOrNull())

                        /**
                         * Sets [Builder.providedLastName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedLastName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedLastName(providedLastName: JsonField<String>) = apply {
                            this.providedLastName = providedLastName
                        }

                        /**
                         * The middle name provided for verification in the authorization request.
                         */
                        fun providedMiddleName(providedMiddleName: String?) =
                            providedMiddleName(JsonField.ofNullable(providedMiddleName))

                        /**
                         * Alias for calling [Builder.providedMiddleName] with
                         * `providedMiddleName.orElse(null)`.
                         */
                        fun providedMiddleName(providedMiddleName: Optional<String>) =
                            providedMiddleName(providedMiddleName.getOrNull())

                        /**
                         * Sets [Builder.providedMiddleName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedMiddleName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedMiddleName(providedMiddleName: JsonField<String>) = apply {
                            this.providedMiddleName = providedMiddleName
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CardholderName].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .providedFirstName()
                         * .providedLastName()
                         * .providedMiddleName()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CardholderName =
                            CardholderName(
                                checkRequired("providedFirstName", providedFirstName),
                                checkRequired("providedLastName", providedLastName),
                                checkRequired("providedMiddleName", providedMiddleName),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CardholderName = apply {
                        if (validated) {
                            return@apply
                        }

                        providedFirstName()
                        providedLastName()
                        providedMiddleName()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (providedFirstName.asKnown().isPresent) 1 else 0) +
                            (if (providedLastName.asKnown().isPresent) 1 else 0) +
                            (if (providedMiddleName.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CardholderName &&
                            providedFirstName == other.providedFirstName &&
                            providedLastName == other.providedLastName &&
                            providedMiddleName == other.providedMiddleName &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            providedFirstName,
                            providedLastName,
                            providedMiddleName,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CardholderName{providedFirstName=$providedFirstName, providedLastName=$providedLastName, providedMiddleName=$providedMiddleName, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Verification &&
                        cardVerificationCode == other.cardVerificationCode &&
                        cardholderAddress == other.cardholderAddress &&
                        cardholderName == other.cardholderName &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        cardVerificationCode,
                        cardholderAddress,
                        cardholderName,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, cardholderName=$cardholderName, additionalProperties=$additionalProperties}"
            }

            override fun equals(other: Any?): Boolean {
                if (this === other) {
                    return true
                }

                return other is CardBalanceInquiry &&
                    id == other.id &&
                    additionalAmounts == other.additionalAmounts &&
                    balance == other.balance &&
                    cardPaymentId == other.cardPaymentId &&
                    currency == other.currency &&
                    digitalWalletTokenId == other.digitalWalletTokenId &&
                    merchantAcceptorId == other.merchantAcceptorId &&
                    merchantCategoryCode == other.merchantCategoryCode &&
                    merchantCity == other.merchantCity &&
                    merchantCountry == other.merchantCountry &&
                    merchantDescriptor == other.merchantDescriptor &&
                    merchantPostalCode == other.merchantPostalCode &&
                    merchantState == other.merchantState &&
                    networkDetails == other.networkDetails &&
                    networkIdentifiers == other.networkIdentifiers &&
                    networkRiskScore == other.networkRiskScore &&
                    physicalCardId == other.physicalCardId &&
                    realTimeDecisionId == other.realTimeDecisionId &&
                    schemeFees == other.schemeFees &&
                    terminalId == other.terminalId &&
                    type == other.type &&
                    verification == other.verification &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    id,
                    additionalAmounts,
                    balance,
                    cardPaymentId,
                    currency,
                    digitalWalletTokenId,
                    merchantAcceptorId,
                    merchantCategoryCode,
                    merchantCity,
                    merchantCountry,
                    merchantDescriptor,
                    merchantPostalCode,
                    merchantState,
                    networkDetails,
                    networkIdentifiers,
                    networkRiskScore,
                    physicalCardId,
                    realTimeDecisionId,
                    schemeFees,
                    terminalId,
                    type,
                    verification,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardBalanceInquiry{id=$id, additionalAmounts=$additionalAmounts, balance=$balance, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, realTimeDecisionId=$realTimeDecisionId, schemeFees=$schemeFees, terminalId=$terminalId, type=$type, verification=$verification, additionalProperties=$additionalProperties}"
        }

        /**
         * A Card Decline object. This field will be present in the JSON response if and only if
         * `category` is equal to `card_decline`.
         */
        class CardDecline
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val id: JsonField<String>,
            private val actioner: JsonField<Actioner>,
            private val additionalAmounts: JsonField<AdditionalAmounts>,
            private val amount: JsonField<Long>,
            private val cardPaymentId: JsonField<String>,
            private val currency: JsonField<Currency>,
            private val declinedTransactionId: JsonField<String>,
            private val digitalWalletTokenId: JsonField<String>,
            private val direction: JsonField<Direction>,
            private val incrementedCardAuthorizationId: JsonField<String>,
            private val merchantAcceptorId: JsonField<String>,
            private val merchantCategoryCode: JsonField<String>,
            private val merchantCity: JsonField<String>,
            private val merchantCountry: JsonField<String>,
            private val merchantDescriptor: JsonField<String>,
            private val merchantPostalCode: JsonField<String>,
            private val merchantState: JsonField<String>,
            private val networkDetails: JsonField<NetworkDetails>,
            private val networkIdentifiers: JsonField<NetworkIdentifiers>,
            private val networkRiskScore: JsonField<Long>,
            private val physicalCardId: JsonField<String>,
            private val presentmentAmount: JsonField<Long>,
            private val presentmentCurrency: JsonField<String>,
            private val processingCategory: JsonField<ProcessingCategory>,
            private val realTimeDecisionId: JsonField<String>,
            private val realTimeDecisionReason: JsonField<RealTimeDecisionReason>,
            private val reason: JsonField<Reason>,
            private val schemeFees: JsonField<List<SchemeFee>>,
            private val terminalId: JsonField<String>,
            private val verification: JsonField<Verification>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
                @JsonProperty("actioner")
                @ExcludeMissing
                actioner: JsonField<Actioner> = JsonMissing.of(),
                @JsonProperty("additional_amounts")
                @ExcludeMissing
                additionalAmounts: JsonField<AdditionalAmounts> = JsonMissing.of(),
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("card_payment_id")
                @ExcludeMissing
                cardPaymentId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("declined_transaction_id")
                @ExcludeMissing
                declinedTransactionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("digital_wallet_token_id")
                @ExcludeMissing
                digitalWalletTokenId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("direction")
                @ExcludeMissing
                direction: JsonField<Direction> = JsonMissing.of(),
                @JsonProperty("incremented_card_authorization_id")
                @ExcludeMissing
                incrementedCardAuthorizationId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_acceptor_id")
                @ExcludeMissing
                merchantAcceptorId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_category_code")
                @ExcludeMissing
                merchantCategoryCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_city")
                @ExcludeMissing
                merchantCity: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_country")
                @ExcludeMissing
                merchantCountry: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_descriptor")
                @ExcludeMissing
                merchantDescriptor: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_postal_code")
                @ExcludeMissing
                merchantPostalCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_state")
                @ExcludeMissing
                merchantState: JsonField<String> = JsonMissing.of(),
                @JsonProperty("network_details")
                @ExcludeMissing
                networkDetails: JsonField<NetworkDetails> = JsonMissing.of(),
                @JsonProperty("network_identifiers")
                @ExcludeMissing
                networkIdentifiers: JsonField<NetworkIdentifiers> = JsonMissing.of(),
                @JsonProperty("network_risk_score")
                @ExcludeMissing
                networkRiskScore: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("physical_card_id")
                @ExcludeMissing
                physicalCardId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("presentment_amount")
                @ExcludeMissing
                presentmentAmount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("presentment_currency")
                @ExcludeMissing
                presentmentCurrency: JsonField<String> = JsonMissing.of(),
                @JsonProperty("processing_category")
                @ExcludeMissing
                processingCategory: JsonField<ProcessingCategory> = JsonMissing.of(),
                @JsonProperty("real_time_decision_id")
                @ExcludeMissing
                realTimeDecisionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("real_time_decision_reason")
                @ExcludeMissing
                realTimeDecisionReason: JsonField<RealTimeDecisionReason> = JsonMissing.of(),
                @JsonProperty("reason")
                @ExcludeMissing
                reason: JsonField<Reason> = JsonMissing.of(),
                @JsonProperty("scheme_fees")
                @ExcludeMissing
                schemeFees: JsonField<List<SchemeFee>> = JsonMissing.of(),
                @JsonProperty("terminal_id")
                @ExcludeMissing
                terminalId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("verification")
                @ExcludeMissing
                verification: JsonField<Verification> = JsonMissing.of(),
            ) : this(
                id,
                actioner,
                additionalAmounts,
                amount,
                cardPaymentId,
                currency,
                declinedTransactionId,
                digitalWalletTokenId,
                direction,
                incrementedCardAuthorizationId,
                merchantAcceptorId,
                merchantCategoryCode,
                merchantCity,
                merchantCountry,
                merchantDescriptor,
                merchantPostalCode,
                merchantState,
                networkDetails,
                networkIdentifiers,
                networkRiskScore,
                physicalCardId,
                presentmentAmount,
                presentmentCurrency,
                processingCategory,
                realTimeDecisionId,
                realTimeDecisionReason,
                reason,
                schemeFees,
                terminalId,
                verification,
                mutableMapOf(),
            )

            /**
             * The Card Decline identifier.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun id(): String = id.getRequired("id")

            /**
             * Whether this authorization was approved by Increase, the card network through
             * stand-in processing, or the user through a real-time decision.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun actioner(): Actioner = actioner.getRequired("actioner")

            /**
             * Additional amounts associated with the card authorization, such as ATM surcharges
             * fees. These are usually a subset of the `amount` field and are used to provide more
             * detailed information about the transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun additionalAmounts(): AdditionalAmounts =
                additionalAmounts.getRequired("additional_amounts")

            /**
             * The declined amount in the minor unit of the destination account currency. For
             * dollars, for example, this is cents.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun amount(): Long = amount.getRequired("amount")

            /**
             * The ID of the Card Payment this transaction belongs to.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun cardPaymentId(): String = cardPaymentId.getRequired("card_payment_id")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination
             * account currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun currency(): Currency = currency.getRequired("currency")

            /**
             * The identifier of the declined transaction created for this Card Decline.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun declinedTransactionId(): String =
                declinedTransactionId.getRequired("declined_transaction_id")

            /**
             * If the authorization was made via a Digital Wallet Token (such as an Apple Pay
             * purchase), the identifier of the token that was used.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun digitalWalletTokenId(): Optional<String> =
                digitalWalletTokenId.getOptional("digital_wallet_token_id")

            /**
             * The direction describes the direction the funds will move, either from the cardholder
             * to the merchant or from the merchant to the cardholder.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun direction(): Direction = direction.getRequired("direction")

            /**
             * The identifier of the card authorization this request attempted to incrementally
             * authorize.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun incrementedCardAuthorizationId(): Optional<String> =
                incrementedCardAuthorizationId.getOptional("incremented_card_authorization_id")

            /**
             * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantAcceptorId(): String =
                merchantAcceptorId.getRequired("merchant_acceptor_id")

            /**
             * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCategoryCode(): String =
                merchantCategoryCode.getRequired("merchant_category_code")

            /**
             * The city the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantCity(): Optional<String> = merchantCity.getOptional("merchant_city")

            /**
             * The country the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCountry(): String = merchantCountry.getRequired("merchant_country")

            /**
             * The merchant descriptor of the merchant the card is transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantDescriptor(): String = merchantDescriptor.getRequired("merchant_descriptor")

            /**
             * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit ZIP
             * code, where the first 5 and last 4 are separated by a dash.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantPostalCode(): Optional<String> =
                merchantPostalCode.getOptional("merchant_postal_code")

            /**
             * The state the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantState(): Optional<String> = merchantState.getOptional("merchant_state")

            /**
             * Fields specific to the `network`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details")

            /**
             * Network-specific identifiers for a specific request or transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun networkIdentifiers(): NetworkIdentifiers =
                networkIdentifiers.getRequired("network_identifiers")

            /**
             * The risk score generated by the card network. For Visa this is the Visa Advanced
             * Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the score
             * is from 0 to 999, where 999 is the riskiest.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun networkRiskScore(): Optional<Long> =
                networkRiskScore.getOptional("network_risk_score")

            /**
             * If the authorization was made in-person with a physical card, the Physical Card that
             * was used.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun physicalCardId(): Optional<String> = physicalCardId.getOptional("physical_card_id")

            /**
             * The declined amount in the minor unit of the transaction's presentment currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun presentmentAmount(): Long = presentmentAmount.getRequired("presentment_amount")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
             * presentment currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun presentmentCurrency(): String =
                presentmentCurrency.getRequired("presentment_currency")

            /**
             * The processing category describes the intent behind the authorization, such as
             * whether it was used for bill payments or an automatic fuel dispenser.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun processingCategory(): ProcessingCategory =
                processingCategory.getRequired("processing_category")

            /**
             * The identifier of the Real-Time Decision sent to approve or decline this transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun realTimeDecisionId(): Optional<String> =
                realTimeDecisionId.getOptional("real_time_decision_id")

            /**
             * This is present if a specific decline reason was given in the real-time decision.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun realTimeDecisionReason(): Optional<RealTimeDecisionReason> =
                realTimeDecisionReason.getOptional("real_time_decision_reason")

            /**
             * Why the transaction was declined.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun reason(): Reason = reason.getRequired("reason")

            /**
             * The scheme fees associated with this card decline.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun schemeFees(): List<SchemeFee> = schemeFees.getRequired("scheme_fees")

            /**
             * The terminal identifier (commonly abbreviated as TID) of the terminal the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun terminalId(): Optional<String> = terminalId.getOptional("terminal_id")

            /**
             * Fields related to verification of cardholder-provided values.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun verification(): Verification = verification.getRequired("verification")

            /**
             * Returns the raw JSON value of [id].
             *
             * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id

            /**
             * Returns the raw JSON value of [actioner].
             *
             * Unlike [actioner], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("actioner")
            @ExcludeMissing
            fun _actioner(): JsonField<Actioner> = actioner

            /**
             * Returns the raw JSON value of [additionalAmounts].
             *
             * Unlike [additionalAmounts], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("additional_amounts")
            @ExcludeMissing
            fun _additionalAmounts(): JsonField<AdditionalAmounts> = additionalAmounts

            /**
             * Returns the raw JSON value of [amount].
             *
             * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

            /**
             * Returns the raw JSON value of [cardPaymentId].
             *
             * Unlike [cardPaymentId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("card_payment_id")
            @ExcludeMissing
            fun _cardPaymentId(): JsonField<String> = cardPaymentId

            /**
             * Returns the raw JSON value of [currency].
             *
             * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("currency")
            @ExcludeMissing
            fun _currency(): JsonField<Currency> = currency

            /**
             * Returns the raw JSON value of [declinedTransactionId].
             *
             * Unlike [declinedTransactionId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("declined_transaction_id")
            @ExcludeMissing
            fun _declinedTransactionId(): JsonField<String> = declinedTransactionId

            /**
             * Returns the raw JSON value of [digitalWalletTokenId].
             *
             * Unlike [digitalWalletTokenId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("digital_wallet_token_id")
            @ExcludeMissing
            fun _digitalWalletTokenId(): JsonField<String> = digitalWalletTokenId

            /**
             * Returns the raw JSON value of [direction].
             *
             * Unlike [direction], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("direction")
            @ExcludeMissing
            fun _direction(): JsonField<Direction> = direction

            /**
             * Returns the raw JSON value of [incrementedCardAuthorizationId].
             *
             * Unlike [incrementedCardAuthorizationId], this method doesn't throw if the JSON field
             * has an unexpected type.
             */
            @JsonProperty("incremented_card_authorization_id")
            @ExcludeMissing
            fun _incrementedCardAuthorizationId(): JsonField<String> =
                incrementedCardAuthorizationId

            /**
             * Returns the raw JSON value of [merchantAcceptorId].
             *
             * Unlike [merchantAcceptorId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_acceptor_id")
            @ExcludeMissing
            fun _merchantAcceptorId(): JsonField<String> = merchantAcceptorId

            /**
             * Returns the raw JSON value of [merchantCategoryCode].
             *
             * Unlike [merchantCategoryCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_category_code")
            @ExcludeMissing
            fun _merchantCategoryCode(): JsonField<String> = merchantCategoryCode

            /**
             * Returns the raw JSON value of [merchantCity].
             *
             * Unlike [merchantCity], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_city")
            @ExcludeMissing
            fun _merchantCity(): JsonField<String> = merchantCity

            /**
             * Returns the raw JSON value of [merchantCountry].
             *
             * Unlike [merchantCountry], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_country")
            @ExcludeMissing
            fun _merchantCountry(): JsonField<String> = merchantCountry

            /**
             * Returns the raw JSON value of [merchantDescriptor].
             *
             * Unlike [merchantDescriptor], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_descriptor")
            @ExcludeMissing
            fun _merchantDescriptor(): JsonField<String> = merchantDescriptor

            /**
             * Returns the raw JSON value of [merchantPostalCode].
             *
             * Unlike [merchantPostalCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_postal_code")
            @ExcludeMissing
            fun _merchantPostalCode(): JsonField<String> = merchantPostalCode

            /**
             * Returns the raw JSON value of [merchantState].
             *
             * Unlike [merchantState], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_state")
            @ExcludeMissing
            fun _merchantState(): JsonField<String> = merchantState

            /**
             * Returns the raw JSON value of [networkDetails].
             *
             * Unlike [networkDetails], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_details")
            @ExcludeMissing
            fun _networkDetails(): JsonField<NetworkDetails> = networkDetails

            /**
             * Returns the raw JSON value of [networkIdentifiers].
             *
             * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_identifiers")
            @ExcludeMissing
            fun _networkIdentifiers(): JsonField<NetworkIdentifiers> = networkIdentifiers

            /**
             * Returns the raw JSON value of [networkRiskScore].
             *
             * Unlike [networkRiskScore], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_risk_score")
            @ExcludeMissing
            fun _networkRiskScore(): JsonField<Long> = networkRiskScore

            /**
             * Returns the raw JSON value of [physicalCardId].
             *
             * Unlike [physicalCardId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("physical_card_id")
            @ExcludeMissing
            fun _physicalCardId(): JsonField<String> = physicalCardId

            /**
             * Returns the raw JSON value of [presentmentAmount].
             *
             * Unlike [presentmentAmount], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("presentment_amount")
            @ExcludeMissing
            fun _presentmentAmount(): JsonField<Long> = presentmentAmount

            /**
             * Returns the raw JSON value of [presentmentCurrency].
             *
             * Unlike [presentmentCurrency], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("presentment_currency")
            @ExcludeMissing
            fun _presentmentCurrency(): JsonField<String> = presentmentCurrency

            /**
             * Returns the raw JSON value of [processingCategory].
             *
             * Unlike [processingCategory], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("processing_category")
            @ExcludeMissing
            fun _processingCategory(): JsonField<ProcessingCategory> = processingCategory

            /**
             * Returns the raw JSON value of [realTimeDecisionId].
             *
             * Unlike [realTimeDecisionId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("real_time_decision_id")
            @ExcludeMissing
            fun _realTimeDecisionId(): JsonField<String> = realTimeDecisionId

            /**
             * Returns the raw JSON value of [realTimeDecisionReason].
             *
             * Unlike [realTimeDecisionReason], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("real_time_decision_reason")
            @ExcludeMissing
            fun _realTimeDecisionReason(): JsonField<RealTimeDecisionReason> =
                realTimeDecisionReason

            /**
             * Returns the raw JSON value of [reason].
             *
             * Unlike [reason], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField<Reason> = reason

            /**
             * Returns the raw JSON value of [schemeFees].
             *
             * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("scheme_fees")
            @ExcludeMissing
            fun _schemeFees(): JsonField<List<SchemeFee>> = schemeFees

            /**
             * Returns the raw JSON value of [terminalId].
             *
             * Unlike [terminalId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("terminal_id")
            @ExcludeMissing
            fun _terminalId(): JsonField<String> = terminalId

            /**
             * Returns the raw JSON value of [verification].
             *
             * Unlike [verification], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("verification")
            @ExcludeMissing
            fun _verification(): JsonField<Verification> = verification

            @JsonAnySetter
            private fun putAdditionalProperty(key: String, value: JsonValue) {
                additionalProperties.put(key, value)
            }

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map<String, JsonValue> =
                Collections.unmodifiableMap(additionalProperties)

            fun toBuilder() = Builder().from(this)

            companion object {

                /**
                 * Returns a mutable builder for constructing an instance of [CardDecline].
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .actioner()
                 * .additionalAmounts()
                 * .amount()
                 * .cardPaymentId()
                 * .currency()
                 * .declinedTransactionId()
                 * .digitalWalletTokenId()
                 * .direction()
                 * .incrementedCardAuthorizationId()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCity()
                 * .merchantCountry()
                 * .merchantDescriptor()
                 * .merchantPostalCode()
                 * .merchantState()
                 * .networkDetails()
                 * .networkIdentifiers()
                 * .networkRiskScore()
                 * .physicalCardId()
                 * .presentmentAmount()
                 * .presentmentCurrency()
                 * .processingCategory()
                 * .realTimeDecisionId()
                 * .realTimeDecisionReason()
                 * .reason()
                 * .schemeFees()
                 * .terminalId()
                 * .verification()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

            /** A builder for [CardDecline]. */
            class Builder internal constructor() {

                private var id: JsonField<String>? = null
                private var actioner: JsonField<Actioner>? = null
                private var additionalAmounts: JsonField<AdditionalAmounts>? = null
                private var amount: JsonField<Long>? = null
                private var cardPaymentId: JsonField<String>? = null
                private var currency: JsonField<Currency>? = null
                private var declinedTransactionId: JsonField<String>? = null
                private var digitalWalletTokenId: JsonField<String>? = null
                private var direction: JsonField<Direction>? = null
                private var incrementedCardAuthorizationId: JsonField<String>? = null
                private var merchantAcceptorId: JsonField<String>? = null
                private var merchantCategoryCode: JsonField<String>? = null
                private var merchantCity: JsonField<String>? = null
                private var merchantCountry: JsonField<String>? = null
                private var merchantDescriptor: JsonField<String>? = null
                private var merchantPostalCode: JsonField<String>? = null
                private var merchantState: JsonField<String>? = null
                private var networkDetails: JsonField<NetworkDetails>? = null
                private var networkIdentifiers: JsonField<NetworkIdentifiers>? = null
                private var networkRiskScore: JsonField<Long>? = null
                private var physicalCardId: JsonField<String>? = null
                private var presentmentAmount: JsonField<Long>? = null
                private var presentmentCurrency: JsonField<String>? = null
                private var processingCategory: JsonField<ProcessingCategory>? = null
                private var realTimeDecisionId: JsonField<String>? = null
                private var realTimeDecisionReason: JsonField<RealTimeDecisionReason>? = null
                private var reason: JsonField<Reason>? = null
                private var schemeFees: JsonField<MutableList<SchemeFee>>? = null
                private var terminalId: JsonField<String>? = null
                private var verification: JsonField<Verification>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardDecline: CardDecline) = apply {
                    id = cardDecline.id
                    actioner = cardDecline.actioner
                    additionalAmounts = cardDecline.additionalAmounts
                    amount = cardDecline.amount
                    cardPaymentId = cardDecline.cardPaymentId
                    currency = cardDecline.currency
                    declinedTransactionId = cardDecline.declinedTransactionId
                    digitalWalletTokenId = cardDecline.digitalWalletTokenId
                    direction = cardDecline.direction
                    incrementedCardAuthorizationId = cardDecline.incrementedCardAuthorizationId
                    merchantAcceptorId = cardDecline.merchantAcceptorId
                    merchantCategoryCode = cardDecline.merchantCategoryCode
                    merchantCity = cardDecline.merchantCity
                    merchantCountry = cardDecline.merchantCountry
                    merchantDescriptor = cardDecline.merchantDescriptor
                    merchantPostalCode = cardDecline.merchantPostalCode
                    merchantState = cardDecline.merchantState
                    networkDetails = cardDecline.networkDetails
                    networkIdentifiers = cardDecline.networkIdentifiers
                    networkRiskScore = cardDecline.networkRiskScore
                    physicalCardId = cardDecline.physicalCardId
                    presentmentAmount = cardDecline.presentmentAmount
                    presentmentCurrency = cardDecline.presentmentCurrency
                    processingCategory = cardDecline.processingCategory
                    realTimeDecisionId = cardDecline.realTimeDecisionId
                    realTimeDecisionReason = cardDecline.realTimeDecisionReason
                    reason = cardDecline.reason
                    schemeFees = cardDecline.schemeFees.map { it.toMutableList() }
                    terminalId = cardDecline.terminalId
                    verification = cardDecline.verification
                    additionalProperties = cardDecline.additionalProperties.toMutableMap()
                }

                /** The Card Decline identifier. */
                fun id(id: String) = id(JsonField.of(id))

                /**
                 * Sets [Builder.id] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.id] with a well-typed [String] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun id(id: JsonField<String>) = apply { this.id = id }

                /**
                 * Whether this authorization was approved by Increase, the card network through
                 * stand-in processing, or the user through a real-time decision.
                 */
                fun actioner(actioner: Actioner) = actioner(JsonField.of(actioner))

                /**
                 * Sets [Builder.actioner] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.actioner] with a well-typed [Actioner] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun actioner(actioner: JsonField<Actioner>) = apply { this.actioner = actioner }

                /**
                 * Additional amounts associated with the card authorization, such as ATM surcharges
                 * fees. These are usually a subset of the `amount` field and are used to provide
                 * more detailed information about the transaction.
                 */
                fun additionalAmounts(additionalAmounts: AdditionalAmounts) =
                    additionalAmounts(JsonField.of(additionalAmounts))

                /**
                 * Sets [Builder.additionalAmounts] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.additionalAmounts] with a well-typed
                 * [AdditionalAmounts] value instead. This method is primarily for setting the field
                 * to an undocumented or not yet supported value.
                 */
                fun additionalAmounts(additionalAmounts: JsonField<AdditionalAmounts>) = apply {
                    this.additionalAmounts = additionalAmounts
                }

                /**
                 * The declined amount in the minor unit of the destination account currency. For
                 * dollars, for example, this is cents.
                 */
                fun amount(amount: Long) = amount(JsonField.of(amount))

                /**
                 * Sets [Builder.amount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.amount] with a well-typed [Long] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                /** The ID of the Card Payment this transaction belongs to. */
                fun cardPaymentId(cardPaymentId: String) =
                    cardPaymentId(JsonField.of(cardPaymentId))

                /**
                 * Sets [Builder.cardPaymentId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cardPaymentId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun cardPaymentId(cardPaymentId: JsonField<String>) = apply {
                    this.cardPaymentId = cardPaymentId
                }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination
                 * account currency.
                 */
                fun currency(currency: Currency) = currency(JsonField.of(currency))

                /**
                 * Sets [Builder.currency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.currency] with a well-typed [Currency] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                /** The identifier of the declined transaction created for this Card Decline. */
                fun declinedTransactionId(declinedTransactionId: String) =
                    declinedTransactionId(JsonField.of(declinedTransactionId))

                /**
                 * Sets [Builder.declinedTransactionId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.declinedTransactionId] with a well-typed
                 * [String] value instead. This method is primarily for setting the field to an
                 * undocumented or not yet supported value.
                 */
                fun declinedTransactionId(declinedTransactionId: JsonField<String>) = apply {
                    this.declinedTransactionId = declinedTransactionId
                }

                /**
                 * If the authorization was made via a Digital Wallet Token (such as an Apple Pay
                 * purchase), the identifier of the token that was used.
                 */
                fun digitalWalletTokenId(digitalWalletTokenId: String?) =
                    digitalWalletTokenId(JsonField.ofNullable(digitalWalletTokenId))

                /**
                 * Alias for calling [Builder.digitalWalletTokenId] with
                 * `digitalWalletTokenId.orElse(null)`.
                 */
                fun digitalWalletTokenId(digitalWalletTokenId: Optional<String>) =
                    digitalWalletTokenId(digitalWalletTokenId.getOrNull())

                /**
                 * Sets [Builder.digitalWalletTokenId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.digitalWalletTokenId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun digitalWalletTokenId(digitalWalletTokenId: JsonField<String>) = apply {
                    this.digitalWalletTokenId = digitalWalletTokenId
                }

                /**
                 * The direction describes the direction the funds will move, either from the
                 * cardholder to the merchant or from the merchant to the cardholder.
                 */
                fun direction(direction: Direction) = direction(JsonField.of(direction))

                /**
                 * Sets [Builder.direction] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.direction] with a well-typed [Direction] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun direction(direction: JsonField<Direction>) = apply {
                    this.direction = direction
                }

                /**
                 * The identifier of the card authorization this request attempted to incrementally
                 * authorize.
                 */
                fun incrementedCardAuthorizationId(incrementedCardAuthorizationId: String?) =
                    incrementedCardAuthorizationId(
                        JsonField.ofNullable(incrementedCardAuthorizationId)
                    )

                /**
                 * Alias for calling [Builder.incrementedCardAuthorizationId] with
                 * `incrementedCardAuthorizationId.orElse(null)`.
                 */
                fun incrementedCardAuthorizationId(
                    incrementedCardAuthorizationId: Optional<String>
                ) = incrementedCardAuthorizationId(incrementedCardAuthorizationId.getOrNull())

                /**
                 * Sets [Builder.incrementedCardAuthorizationId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.incrementedCardAuthorizationId] with a
                 * well-typed [String] value instead. This method is primarily for setting the field
                 * to an undocumented or not yet supported value.
                 */
                fun incrementedCardAuthorizationId(
                    incrementedCardAuthorizationId: JsonField<String>
                ) = apply { this.incrementedCardAuthorizationId = incrementedCardAuthorizationId }

                /**
                 * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
                 * transacting with.
                 */
                fun merchantAcceptorId(merchantAcceptorId: String) =
                    merchantAcceptorId(JsonField.of(merchantAcceptorId))

                /**
                 * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantAcceptorId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantAcceptorId(merchantAcceptorId: JsonField<String>) = apply {
                    this.merchantAcceptorId = merchantAcceptorId
                }

                /**
                 * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card
                 * is transacting with.
                 */
                fun merchantCategoryCode(merchantCategoryCode: String) =
                    merchantCategoryCode(JsonField.of(merchantCategoryCode))

                /**
                 * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCategoryCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCategoryCode(merchantCategoryCode: JsonField<String>) = apply {
                    this.merchantCategoryCode = merchantCategoryCode
                }

                /** The city the merchant resides in. */
                fun merchantCity(merchantCity: String?) =
                    merchantCity(JsonField.ofNullable(merchantCity))

                /** Alias for calling [Builder.merchantCity] with `merchantCity.orElse(null)`. */
                fun merchantCity(merchantCity: Optional<String>) =
                    merchantCity(merchantCity.getOrNull())

                /**
                 * Sets [Builder.merchantCity] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCity] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantCity(merchantCity: JsonField<String>) = apply {
                    this.merchantCity = merchantCity
                }

                /** The country the merchant resides in. */
                fun merchantCountry(merchantCountry: String) =
                    merchantCountry(JsonField.of(merchantCountry))

                /**
                 * Sets [Builder.merchantCountry] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCountry] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCountry(merchantCountry: JsonField<String>) = apply {
                    this.merchantCountry = merchantCountry
                }

                /** The merchant descriptor of the merchant the card is transacting with. */
                fun merchantDescriptor(merchantDescriptor: String) =
                    merchantDescriptor(JsonField.of(merchantDescriptor))

                /**
                 * Sets [Builder.merchantDescriptor] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantDescriptor] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantDescriptor(merchantDescriptor: JsonField<String>) = apply {
                    this.merchantDescriptor = merchantDescriptor
                }

                /**
                 * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit
                 * ZIP code, where the first 5 and last 4 are separated by a dash.
                 */
                fun merchantPostalCode(merchantPostalCode: String?) =
                    merchantPostalCode(JsonField.ofNullable(merchantPostalCode))

                /**
                 * Alias for calling [Builder.merchantPostalCode] with
                 * `merchantPostalCode.orElse(null)`.
                 */
                fun merchantPostalCode(merchantPostalCode: Optional<String>) =
                    merchantPostalCode(merchantPostalCode.getOrNull())

                /**
                 * Sets [Builder.merchantPostalCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantPostalCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantPostalCode(merchantPostalCode: JsonField<String>) = apply {
                    this.merchantPostalCode = merchantPostalCode
                }

                /** The state the merchant resides in. */
                fun merchantState(merchantState: String?) =
                    merchantState(JsonField.ofNullable(merchantState))

                /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */
                fun merchantState(merchantState: Optional<String>) =
                    merchantState(merchantState.getOrNull())

                /**
                 * Sets [Builder.merchantState] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantState] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantState(merchantState: JsonField<String>) = apply {
                    this.merchantState = merchantState
                }

                /** Fields specific to the `network`. */
                fun networkDetails(networkDetails: NetworkDetails) =
                    networkDetails(JsonField.of(networkDetails))

                /**
                 * Sets [Builder.networkDetails] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkDetails] with a well-typed
                 * [NetworkDetails] value instead. This method is primarily for setting the field to
                 * an undocumented or not yet supported value.
                 */
                fun networkDetails(networkDetails: JsonField<NetworkDetails>) = apply {
                    this.networkDetails = networkDetails
                }

                /** Network-specific identifiers for a specific request or transaction. */
                fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) =
                    networkIdentifiers(JsonField.of(networkIdentifiers))

                /**
                 * Sets [Builder.networkIdentifiers] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkIdentifiers] with a well-typed
                 * [NetworkIdentifiers] value instead. This method is primarily for setting the
                 * field to an undocumented or not yet supported value.
                 */
                fun networkIdentifiers(networkIdentifiers: JsonField<NetworkIdentifiers>) = apply {
                    this.networkIdentifiers = networkIdentifiers
                }

                /**
                 * The risk score generated by the card network. For Visa this is the Visa Advanced
                 * Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the
                 * score is from 0 to 999, where 999 is the riskiest.
                 */
                fun networkRiskScore(networkRiskScore: Long?) =
                    networkRiskScore(JsonField.ofNullable(networkRiskScore))

                /**
                 * Alias for [Builder.networkRiskScore].
                 *
                 * This unboxed primitive overload exists for backwards compatibility.
                 */
                fun networkRiskScore(networkRiskScore: Long) =
                    networkRiskScore(networkRiskScore as Long?)

                /**
                 * Alias for calling [Builder.networkRiskScore] with
                 * `networkRiskScore.orElse(null)`.
                 */
                fun networkRiskScore(networkRiskScore: Optional<Long>) =
                    networkRiskScore(networkRiskScore.getOrNull())

                /**
                 * Sets [Builder.networkRiskScore] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkRiskScore] with a well-typed [Long] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun networkRiskScore(networkRiskScore: JsonField<Long>) = apply {
                    this.networkRiskScore = networkRiskScore
                }

                /**
                 * If the authorization was made in-person with a physical card, the Physical Card
                 * that was used.
                 */
                fun physicalCardId(physicalCardId: String?) =
                    physicalCardId(JsonField.ofNullable(physicalCardId))

                /**
                 * Alias for calling [Builder.physicalCardId] with `physicalCardId.orElse(null)`.
                 */
                fun physicalCardId(physicalCardId: Optional<String>) =
                    physicalCardId(physicalCardId.getOrNull())

                /**
                 * Sets [Builder.physicalCardId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.physicalCardId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun physicalCardId(physicalCardId: JsonField<String>) = apply {
                    this.physicalCardId = physicalCardId
                }

                /**
                 * The declined amount in the minor unit of the transaction's presentment currency.
                 */
                fun presentmentAmount(presentmentAmount: Long) =
                    presentmentAmount(JsonField.of(presentmentAmount))

                /**
                 * Sets [Builder.presentmentAmount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.presentmentAmount] with a well-typed [Long]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun presentmentAmount(presentmentAmount: JsonField<Long>) = apply {
                    this.presentmentAmount = presentmentAmount
                }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
                 * presentment currency.
                 */
                fun presentmentCurrency(presentmentCurrency: String) =
                    presentmentCurrency(JsonField.of(presentmentCurrency))

                /**
                 * Sets [Builder.presentmentCurrency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.presentmentCurrency] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun presentmentCurrency(presentmentCurrency: JsonField<String>) = apply {
                    this.presentmentCurrency = presentmentCurrency
                }

                /**
                 * The processing category describes the intent behind the authorization, such as
                 * whether it was used for bill payments or an automatic fuel dispenser.
                 */
                fun processingCategory(processingCategory: ProcessingCategory) =
                    processingCategory(JsonField.of(processingCategory))

                /**
                 * Sets [Builder.processingCategory] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.processingCategory] with a well-typed
                 * [ProcessingCategory] value instead. This method is primarily for setting the
                 * field to an undocumented or not yet supported value.
                 */
                fun processingCategory(processingCategory: JsonField<ProcessingCategory>) = apply {
                    this.processingCategory = processingCategory
                }

                /**
                 * The identifier of the Real-Time Decision sent to approve or decline this
                 * transaction.
                 */
                fun realTimeDecisionId(realTimeDecisionId: String?) =
                    realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId))

                /**
                 * Alias for calling [Builder.realTimeDecisionId] with
                 * `realTimeDecisionId.orElse(null)`.
                 */
                fun realTimeDecisionId(realTimeDecisionId: Optional<String>) =
                    realTimeDecisionId(realTimeDecisionId.getOrNull())

                /**
                 * Sets [Builder.realTimeDecisionId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.realTimeDecisionId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun realTimeDecisionId(realTimeDecisionId: JsonField<String>) = apply {
                    this.realTimeDecisionId = realTimeDecisionId
                }

                /**
                 * This is present if a specific decline reason was given in the real-time decision.
                 */
                fun realTimeDecisionReason(realTimeDecisionReason: RealTimeDecisionReason?) =
                    realTimeDecisionReason(JsonField.ofNullable(realTimeDecisionReason))

                /**
                 * Alias for calling [Builder.realTimeDecisionReason] with
                 * `realTimeDecisionReason.orElse(null)`.
                 */
                fun realTimeDecisionReason(
                    realTimeDecisionReason: Optional<RealTimeDecisionReason>
                ) = realTimeDecisionReason(realTimeDecisionReason.getOrNull())

                /**
                 * Sets [Builder.realTimeDecisionReason] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.realTimeDecisionReason] with a well-typed
                 * [RealTimeDecisionReason] value instead. This method is primarily for setting the
                 * field to an undocumented or not yet supported value.
                 */
                fun realTimeDecisionReason(
                    realTimeDecisionReason: JsonField<RealTimeDecisionReason>
                ) = apply { this.realTimeDecisionReason = realTimeDecisionReason }

                /** Why the transaction was declined. */
                fun reason(reason: Reason) = reason(JsonField.of(reason))

                /**
                 * Sets [Builder.reason] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.reason] with a well-typed [Reason] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun reason(reason: JsonField<Reason>) = apply { this.reason = reason }

                /** The scheme fees associated with this card decline. */
                fun schemeFees(schemeFees: List<SchemeFee>) = schemeFees(JsonField.of(schemeFees))

                /**
                 * Sets [Builder.schemeFees] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.schemeFees] with a well-typed `List<SchemeFee>`
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun schemeFees(schemeFees: JsonField<List<SchemeFee>>) = apply {
                    this.schemeFees = schemeFees.map { it.toMutableList() }
                }

                /**
                 * Adds a single [SchemeFee] to [schemeFees].
                 *
                 * @throws IllegalStateException if the field was previously set to a non-list.
                 */
                fun addSchemeFee(schemeFee: SchemeFee) = apply {
                    schemeFees =
                        (schemeFees ?: JsonField.of(mutableListOf())).also {
                            checkKnown("schemeFees", it).add(schemeFee)
                        }
                }

                /**
                 * The terminal identifier (commonly abbreviated as TID) of the terminal the card is
                 * transacting with.
                 */
                fun terminalId(terminalId: String?) = terminalId(JsonField.ofNullable(terminalId))

                /** Alias for calling [Builder.terminalId] with `terminalId.orElse(null)`. */
                fun terminalId(terminalId: Optional<String>) = terminalId(terminalId.getOrNull())

                /**
                 * Sets [Builder.terminalId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.terminalId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun terminalId(terminalId: JsonField<String>) = apply {
                    this.terminalId = terminalId
                }

                /** Fields related to verification of cardholder-provided values. */
                fun verification(verification: Verification) =
                    verification(JsonField.of(verification))

                /**
                 * Sets [Builder.verification] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.verification] with a well-typed [Verification]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun verification(verification: JsonField<Verification>) = apply {
                    this.verification = verification
                }

                fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                    this.additionalProperties.clear()
                    putAllAdditionalProperties(additionalProperties)
                }

                fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                    additionalProperties.put(key, value)
                }

                fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun removeAdditionalProperty(key: String) = apply {
                    additionalProperties.remove(key)
                }

                fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                    keys.forEach(::removeAdditionalProperty)
                }

                /**
                 * Returns an immutable instance of [CardDecline].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .actioner()
                 * .additionalAmounts()
                 * .amount()
                 * .cardPaymentId()
                 * .currency()
                 * .declinedTransactionId()
                 * .digitalWalletTokenId()
                 * .direction()
                 * .incrementedCardAuthorizationId()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCity()
                 * .merchantCountry()
                 * .merchantDescriptor()
                 * .merchantPostalCode()
                 * .merchantState()
                 * .networkDetails()
                 * .networkIdentifiers()
                 * .networkRiskScore()
                 * .physicalCardId()
                 * .presentmentAmount()
                 * .presentmentCurrency()
                 * .processingCategory()
                 * .realTimeDecisionId()
                 * .realTimeDecisionReason()
                 * .reason()
                 * .schemeFees()
                 * .terminalId()
                 * .verification()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardDecline =
                    CardDecline(
                        checkRequired("id", id),
                        checkRequired("actioner", actioner),
                        checkRequired("additionalAmounts", additionalAmounts),
                        checkRequired("amount", amount),
                        checkRequired("cardPaymentId", cardPaymentId),
                        checkRequired("currency", currency),
                        checkRequired("declinedTransactionId", declinedTransactionId),
                        checkRequired("digitalWalletTokenId", digitalWalletTokenId),
                        checkRequired("direction", direction),
                        checkRequired(
                            "incrementedCardAuthorizationId",
                            incrementedCardAuthorizationId,
                        ),
                        checkRequired("merchantAcceptorId", merchantAcceptorId),
                        checkRequired("merchantCategoryCode", merchantCategoryCode),
                        checkRequired("merchantCity", merchantCity),
                        checkRequired("merchantCountry", merchantCountry),
                        checkRequired("merchantDescriptor", merchantDescriptor),
                        checkRequired("merchantPostalCode", merchantPostalCode),
                        checkRequired("merchantState", merchantState),
                        checkRequired("networkDetails", networkDetails),
                        checkRequired("networkIdentifiers", networkIdentifiers),
                        checkRequired("networkRiskScore", networkRiskScore),
                        checkRequired("physicalCardId", physicalCardId),
                        checkRequired("presentmentAmount", presentmentAmount),
                        checkRequired("presentmentCurrency", presentmentCurrency),
                        checkRequired("processingCategory", processingCategory),
                        checkRequired("realTimeDecisionId", realTimeDecisionId),
                        checkRequired("realTimeDecisionReason", realTimeDecisionReason),
                        checkRequired("reason", reason),
                        checkRequired("schemeFees", schemeFees).map { it.toImmutable() },
                        checkRequired("terminalId", terminalId),
                        checkRequired("verification", verification),
                        additionalProperties.toMutableMap(),
                    )
            }

            private var validated: Boolean = false

            /**
             * Validates that the types of all values in this object match their expected types
             * recursively.
             *
             * This method is _not_ forwards compatible with new types from the API for existing
             * fields.
             *
             * @throws IncreaseInvalidDataException if any value type in this object doesn't match
             *   its expected type.
             */
            fun validate(): CardDecline = apply {
                if (validated) {
                    return@apply
                }

                id()
                actioner().validate()
                additionalAmounts().validate()
                amount()
                cardPaymentId()
                currency().validate()
                declinedTransactionId()
                digitalWalletTokenId()
                direction().validate()
                incrementedCardAuthorizationId()
                merchantAcceptorId()
                merchantCategoryCode()
                merchantCity()
                merchantCountry()
                merchantDescriptor()
                merchantPostalCode()
                merchantState()
                networkDetails().validate()
                networkIdentifiers().validate()
                networkRiskScore()
                physicalCardId()
                presentmentAmount()
                presentmentCurrency()
                processingCategory().validate()
                realTimeDecisionId()
                realTimeDecisionReason().ifPresent { it.validate() }
                reason().validate()
                schemeFees().forEach { it.validate() }
                terminalId()
                verification().validate()
                validated = true
            }

            fun isValid(): Boolean =
                try {
                    validate()
                    true
                } catch (e: IncreaseInvalidDataException) {
                    false
                }

            /**
             * Returns a score indicating how many valid values are contained in this object
             * recursively.
             *
             * Used for best match union deserialization.
             */
            @JvmSynthetic
            internal fun validity(): Int =
                (if (id.asKnown().isPresent) 1 else 0) +
                    (actioner.asKnown().getOrNull()?.validity() ?: 0) +
                    (additionalAmounts.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (amount.asKnown().isPresent) 1 else 0) +
                    (if (cardPaymentId.asKnown().isPresent) 1 else 0) +
                    (currency.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (declinedTransactionId.asKnown().isPresent) 1 else 0) +
                    (if (digitalWalletTokenId.asKnown().isPresent) 1 else 0) +
                    (direction.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (incrementedCardAuthorizationId.asKnown().isPresent) 1 else 0) +
                    (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) +
                    (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantCity.asKnown().isPresent) 1 else 0) +
                    (if (merchantCountry.asKnown().isPresent) 1 else 0) +
                    (if (merchantDescriptor.asKnown().isPresent) 1 else 0) +
                    (if (merchantPostalCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantState.asKnown().isPresent) 1 else 0) +
                    (networkDetails.asKnown().getOrNull()?.validity() ?: 0) +
                    (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (networkRiskScore.asKnown().isPresent) 1 else 0) +
                    (if (physicalCardId.asKnown().isPresent) 1 else 0) +
                    (if (presentmentAmount.asKnown().isPresent) 1 else 0) +
                    (if (presentmentCurrency.asKnown().isPresent) 1 else 0) +
                    (processingCategory.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) +
                    (realTimeDecisionReason.asKnown().getOrNull()?.validity() ?: 0) +
                    (reason.asKnown().getOrNull()?.validity() ?: 0) +
                    (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
                    (if (terminalId.asKnown().isPresent) 1 else 0) +
                    (verification.asKnown().getOrNull()?.validity() ?: 0)

            /**
             * Whether this authorization was approved by Increase, the card network through
             * stand-in processing, or the user through a real-time decision.
             */
            class Actioner @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** This object was actioned by the user through a real-time decision. */
                    @JvmField val USER = of("user")

                    /** This object was actioned by Increase without user intervention. */
                    @JvmField val INCREASE = of("increase")

                    /** This object was actioned by the network, through stand-in processing. */
                    @JvmField val NETWORK = of("network")

                    @JvmStatic fun of(value: String) = Actioner(JsonField.of(value))
                }

                /** An enum containing [Actioner]'s known values. */
                enum class Known {
                    /** This object was actioned by the user through a real-time decision. */
                    USER,
                    /** This object was actioned by Increase without user intervention. */
                    INCREASE,
                    /** This object was actioned by the network, through stand-in processing. */
                    NETWORK,
                }

                /**
                 * An enum containing [Actioner]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Actioner] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** This object was actioned by the user through a real-time decision. */
                    USER,
                    /** This object was actioned by Increase without user intervention. */
                    INCREASE,
                    /** This object was actioned by the network, through stand-in processing. */
                    NETWORK,
                    /**
                     * An enum member indicating that [Actioner] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        USER -> Value.USER
                        INCREASE -> Value.INCREASE
                        NETWORK -> Value.NETWORK
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        USER -> Known.USER
                        INCREASE -> Known.INCREASE
                        NETWORK -> Known.NETWORK
                        else -> throw IncreaseInvalidDataException("Unknown Actioner: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Actioner = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Actioner && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /**
             * Additional amounts associated with the card authorization, such as ATM surcharges
             * fees. These are usually a subset of the `amount` field and are used to provide more
             * detailed information about the transaction.
             */
            class AdditionalAmounts
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val clinic: JsonField<Clinic>,
                private val dental: JsonField<Dental>,
                private val original: JsonField<Original>,
                private val prescription: JsonField<Prescription>,
                private val surcharge: JsonField<Surcharge>,
                private val totalCumulative: JsonField<TotalCumulative>,
                private val totalHealthcare: JsonField<TotalHealthcare>,
                private val transit: JsonField<Transit>,
                private val unknown: JsonField<Unknown>,
                private val vision: JsonField<Vision>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("clinic")
                    @ExcludeMissing
                    clinic: JsonField<Clinic> = JsonMissing.of(),
                    @JsonProperty("dental")
                    @ExcludeMissing
                    dental: JsonField<Dental> = JsonMissing.of(),
                    @JsonProperty("original")
                    @ExcludeMissing
                    original: JsonField<Original> = JsonMissing.of(),
                    @JsonProperty("prescription")
                    @ExcludeMissing
                    prescription: JsonField<Prescription> = JsonMissing.of(),
                    @JsonProperty("surcharge")
                    @ExcludeMissing
                    surcharge: JsonField<Surcharge> = JsonMissing.of(),
                    @JsonProperty("total_cumulative")
                    @ExcludeMissing
                    totalCumulative: JsonField<TotalCumulative> = JsonMissing.of(),
                    @JsonProperty("total_healthcare")
                    @ExcludeMissing
                    totalHealthcare: JsonField<TotalHealthcare> = JsonMissing.of(),
                    @JsonProperty("transit")
                    @ExcludeMissing
                    transit: JsonField<Transit> = JsonMissing.of(),
                    @JsonProperty("unknown")
                    @ExcludeMissing
                    unknown: JsonField<Unknown> = JsonMissing.of(),
                    @JsonProperty("vision")
                    @ExcludeMissing
                    vision: JsonField<Vision> = JsonMissing.of(),
                ) : this(
                    clinic,
                    dental,
                    original,
                    prescription,
                    surcharge,
                    totalCumulative,
                    totalHealthcare,
                    transit,
                    unknown,
                    vision,
                    mutableMapOf(),
                )

                /**
                 * The part of this transaction amount that was for clinic-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun clinic(): Optional<Clinic> = clinic.getOptional("clinic")

                /**
                 * The part of this transaction amount that was for dental-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun dental(): Optional<Dental> = dental.getOptional("dental")

                /**
                 * The original pre-authorized amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun original(): Optional<Original> = original.getOptional("original")

                /**
                 * The part of this transaction amount that was for healthcare prescriptions.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun prescription(): Optional<Prescription> =
                    prescription.getOptional("prescription")

                /**
                 * The surcharge amount charged for this transaction by the merchant.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun surcharge(): Optional<Surcharge> = surcharge.getOptional("surcharge")

                /**
                 * The total amount of a series of incremental authorizations, optionally provided.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun totalCumulative(): Optional<TotalCumulative> =
                    totalCumulative.getOptional("total_cumulative")

                /**
                 * The total amount of healthcare-related additional amounts.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun totalHealthcare(): Optional<TotalHealthcare> =
                    totalHealthcare.getOptional("total_healthcare")

                /**
                 * The part of this transaction amount that was for transit-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun transit(): Optional<Transit> = transit.getOptional("transit")

                /**
                 * An unknown additional amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun unknown(): Optional<Unknown> = unknown.getOptional("unknown")

                /**
                 * The part of this transaction amount that was for vision-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun vision(): Optional<Vision> = vision.getOptional("vision")

                /**
                 * Returns the raw JSON value of [clinic].
                 *
                 * Unlike [clinic], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("clinic") @ExcludeMissing fun _clinic(): JsonField<Clinic> = clinic

                /**
                 * Returns the raw JSON value of [dental].
                 *
                 * Unlike [dental], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("dental") @ExcludeMissing fun _dental(): JsonField<Dental> = dental

                /**
                 * Returns the raw JSON value of [original].
                 *
                 * Unlike [original], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("original")
                @ExcludeMissing
                fun _original(): JsonField<Original> = original

                /**
                 * Returns the raw JSON value of [prescription].
                 *
                 * Unlike [prescription], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("prescription")
                @ExcludeMissing
                fun _prescription(): JsonField<Prescription> = prescription

                /**
                 * Returns the raw JSON value of [surcharge].
                 *
                 * Unlike [surcharge], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("surcharge")
                @ExcludeMissing
                fun _surcharge(): JsonField<Surcharge> = surcharge

                /**
                 * Returns the raw JSON value of [totalCumulative].
                 *
                 * Unlike [totalCumulative], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("total_cumulative")
                @ExcludeMissing
                fun _totalCumulative(): JsonField<TotalCumulative> = totalCumulative

                /**
                 * Returns the raw JSON value of [totalHealthcare].
                 *
                 * Unlike [totalHealthcare], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("total_healthcare")
                @ExcludeMissing
                fun _totalHealthcare(): JsonField<TotalHealthcare> = totalHealthcare

                /**
                 * Returns the raw JSON value of [transit].
                 *
                 * Unlike [transit], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("transit")
                @ExcludeMissing
                fun _transit(): JsonField<Transit> = transit

                /**
                 * Returns the raw JSON value of [unknown].
                 *
                 * Unlike [unknown], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("unknown")
                @ExcludeMissing
                fun _unknown(): JsonField<Unknown> = unknown

                /**
                 * Returns the raw JSON value of [vision].
                 *
                 * Unlike [vision], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("vision") @ExcludeMissing fun _vision(): JsonField<Vision> = vision

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of
                     * [AdditionalAmounts].
                     *
                     * The following fields are required:
                     * ```java
                     * .clinic()
                     * .dental()
                     * .original()
                     * .prescription()
                     * .surcharge()
                     * .totalCumulative()
                     * .totalHealthcare()
                     * .transit()
                     * .unknown()
                     * .vision()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [AdditionalAmounts]. */
                class Builder internal constructor() {

                    private var clinic: JsonField<Clinic>? = null
                    private var dental: JsonField<Dental>? = null
                    private var original: JsonField<Original>? = null
                    private var prescription: JsonField<Prescription>? = null
                    private var surcharge: JsonField<Surcharge>? = null
                    private var totalCumulative: JsonField<TotalCumulative>? = null
                    private var totalHealthcare: JsonField<TotalHealthcare>? = null
                    private var transit: JsonField<Transit>? = null
                    private var unknown: JsonField<Unknown>? = null
                    private var vision: JsonField<Vision>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(additionalAmounts: AdditionalAmounts) = apply {
                        clinic = additionalAmounts.clinic
                        dental = additionalAmounts.dental
                        original = additionalAmounts.original
                        prescription = additionalAmounts.prescription
                        surcharge = additionalAmounts.surcharge
                        totalCumulative = additionalAmounts.totalCumulative
                        totalHealthcare = additionalAmounts.totalHealthcare
                        transit = additionalAmounts.transit
                        unknown = additionalAmounts.unknown
                        vision = additionalAmounts.vision
                        additionalProperties = additionalAmounts.additionalProperties.toMutableMap()
                    }

                    /** The part of this transaction amount that was for clinic-related services. */
                    fun clinic(clinic: Clinic?) = clinic(JsonField.ofNullable(clinic))

                    /** Alias for calling [Builder.clinic] with `clinic.orElse(null)`. */
                    fun clinic(clinic: Optional<Clinic>) = clinic(clinic.getOrNull())

                    /**
                     * Sets [Builder.clinic] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.clinic] with a well-typed [Clinic] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun clinic(clinic: JsonField<Clinic>) = apply { this.clinic = clinic }

                    /** The part of this transaction amount that was for dental-related services. */
                    fun dental(dental: Dental?) = dental(JsonField.ofNullable(dental))

                    /** Alias for calling [Builder.dental] with `dental.orElse(null)`. */
                    fun dental(dental: Optional<Dental>) = dental(dental.getOrNull())

                    /**
                     * Sets [Builder.dental] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.dental] with a well-typed [Dental] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun dental(dental: JsonField<Dental>) = apply { this.dental = dental }

                    /** The original pre-authorized amount. */
                    fun original(original: Original?) = original(JsonField.ofNullable(original))

                    /** Alias for calling [Builder.original] with `original.orElse(null)`. */
                    fun original(original: Optional<Original>) = original(original.getOrNull())

                    /**
                     * Sets [Builder.original] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.original] with a well-typed [Original] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun original(original: JsonField<Original>) = apply { this.original = original }

                    /**
                     * The part of this transaction amount that was for healthcare prescriptions.
                     */
                    fun prescription(prescription: Prescription?) =
                        prescription(JsonField.ofNullable(prescription))

                    /**
                     * Alias for calling [Builder.prescription] with `prescription.orElse(null)`.
                     */
                    fun prescription(prescription: Optional<Prescription>) =
                        prescription(prescription.getOrNull())

                    /**
                     * Sets [Builder.prescription] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.prescription] with a well-typed
                     * [Prescription] value instead. This method is primarily for setting the field
                     * to an undocumented or not yet supported value.
                     */
                    fun prescription(prescription: JsonField<Prescription>) = apply {
                        this.prescription = prescription
                    }

                    /** The surcharge amount charged for this transaction by the merchant. */
                    fun surcharge(surcharge: Surcharge?) =
                        surcharge(JsonField.ofNullable(surcharge))

                    /** Alias for calling [Builder.surcharge] with `surcharge.orElse(null)`. */
                    fun surcharge(surcharge: Optional<Surcharge>) = surcharge(surcharge.getOrNull())

                    /**
                     * Sets [Builder.surcharge] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.surcharge] with a well-typed [Surcharge]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun surcharge(surcharge: JsonField<Surcharge>) = apply {
                        this.surcharge = surcharge
                    }

                    /**
                     * The total amount of a series of incremental authorizations, optionally
                     * provided.
                     */
                    fun totalCumulative(totalCumulative: TotalCumulative?) =
                        totalCumulative(JsonField.ofNullable(totalCumulative))

                    /**
                     * Alias for calling [Builder.totalCumulative] with
                     * `totalCumulative.orElse(null)`.
                     */
                    fun totalCumulative(totalCumulative: Optional<TotalCumulative>) =
                        totalCumulative(totalCumulative.getOrNull())

                    /**
                     * Sets [Builder.totalCumulative] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.totalCumulative] with a well-typed
                     * [TotalCumulative] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun totalCumulative(totalCumulative: JsonField<TotalCumulative>) = apply {
                        this.totalCumulative = totalCumulative
                    }

                    /** The total amount of healthcare-related additional amounts. */
                    fun totalHealthcare(totalHealthcare: TotalHealthcare?) =
                        totalHealthcare(JsonField.ofNullable(totalHealthcare))

                    /**
                     * Alias for calling [Builder.totalHealthcare] with
                     * `totalHealthcare.orElse(null)`.
                     */
                    fun totalHealthcare(totalHealthcare: Optional<TotalHealthcare>) =
                        totalHealthcare(totalHealthcare.getOrNull())

                    /**
                     * Sets [Builder.totalHealthcare] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.totalHealthcare] with a well-typed
                     * [TotalHealthcare] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun totalHealthcare(totalHealthcare: JsonField<TotalHealthcare>) = apply {
                        this.totalHealthcare = totalHealthcare
                    }

                    /**
                     * The part of this transaction amount that was for transit-related services.
                     */
                    fun transit(transit: Transit?) = transit(JsonField.ofNullable(transit))

                    /** Alias for calling [Builder.transit] with `transit.orElse(null)`. */
                    fun transit(transit: Optional<Transit>) = transit(transit.getOrNull())

                    /**
                     * Sets [Builder.transit] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.transit] with a well-typed [Transit] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun transit(transit: JsonField<Transit>) = apply { this.transit = transit }

                    /** An unknown additional amount. */
                    fun unknown(unknown: Unknown?) = unknown(JsonField.ofNullable(unknown))

                    /** Alias for calling [Builder.unknown] with `unknown.orElse(null)`. */
                    fun unknown(unknown: Optional<Unknown>) = unknown(unknown.getOrNull())

                    /**
                     * Sets [Builder.unknown] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.unknown] with a well-typed [Unknown] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun unknown(unknown: JsonField<Unknown>) = apply { this.unknown = unknown }

                    /** The part of this transaction amount that was for vision-related services. */
                    fun vision(vision: Vision?) = vision(JsonField.ofNullable(vision))

                    /** Alias for calling [Builder.vision] with `vision.orElse(null)`. */
                    fun vision(vision: Optional<Vision>) = vision(vision.getOrNull())

                    /**
                     * Sets [Builder.vision] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.vision] with a well-typed [Vision] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun vision(vision: JsonField<Vision>) = apply { this.vision = vision }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [AdditionalAmounts].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .clinic()
                     * .dental()
                     * .original()
                     * .prescription()
                     * .surcharge()
                     * .totalCumulative()
                     * .totalHealthcare()
                     * .transit()
                     * .unknown()
                     * .vision()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): AdditionalAmounts =
                        AdditionalAmounts(
                            checkRequired("clinic", clinic),
                            checkRequired("dental", dental),
                            checkRequired("original", original),
                            checkRequired("prescription", prescription),
                            checkRequired("surcharge", surcharge),
                            checkRequired("totalCumulative", totalCumulative),
                            checkRequired("totalHealthcare", totalHealthcare),
                            checkRequired("transit", transit),
                            checkRequired("unknown", unknown),
                            checkRequired("vision", vision),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): AdditionalAmounts = apply {
                    if (validated) {
                        return@apply
                    }

                    clinic().ifPresent { it.validate() }
                    dental().ifPresent { it.validate() }
                    original().ifPresent { it.validate() }
                    prescription().ifPresent { it.validate() }
                    surcharge().ifPresent { it.validate() }
                    totalCumulative().ifPresent { it.validate() }
                    totalHealthcare().ifPresent { it.validate() }
                    transit().ifPresent { it.validate() }
                    unknown().ifPresent { it.validate() }
                    vision().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (clinic.asKnown().getOrNull()?.validity() ?: 0) +
                        (dental.asKnown().getOrNull()?.validity() ?: 0) +
                        (original.asKnown().getOrNull()?.validity() ?: 0) +
                        (prescription.asKnown().getOrNull()?.validity() ?: 0) +
                        (surcharge.asKnown().getOrNull()?.validity() ?: 0) +
                        (totalCumulative.asKnown().getOrNull()?.validity() ?: 0) +
                        (totalHealthcare.asKnown().getOrNull()?.validity() ?: 0) +
                        (transit.asKnown().getOrNull()?.validity() ?: 0) +
                        (unknown.asKnown().getOrNull()?.validity() ?: 0) +
                        (vision.asKnown().getOrNull()?.validity() ?: 0)

                /** The part of this transaction amount that was for clinic-related services. */
                class Clinic
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Clinic].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Clinic]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(clinic: Clinic) = apply {
                            amount = clinic.amount
                            currency = clinic.currency
                            additionalProperties = clinic.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Clinic].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Clinic =
                            Clinic(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Clinic = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Clinic &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Clinic{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for dental-related services. */
                class Dental
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Dental].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Dental]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(dental: Dental) = apply {
                            amount = dental.amount
                            currency = dental.currency
                            additionalProperties = dental.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Dental].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Dental =
                            Dental(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Dental = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Dental &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Dental{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The original pre-authorized amount. */
                class Original
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Original].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Original]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(original: Original) = apply {
                            amount = original.amount
                            currency = original.currency
                            additionalProperties = original.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Original].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Original =
                            Original(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Original = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Original &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Original{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for healthcare prescriptions. */
                class Prescription
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Prescription].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Prescription]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(prescription: Prescription) = apply {
                            amount = prescription.amount
                            currency = prescription.currency
                            additionalProperties = prescription.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Prescription].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Prescription =
                            Prescription(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Prescription = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Prescription &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Prescription{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The surcharge amount charged for this transaction by the merchant. */
                class Surcharge
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Surcharge].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Surcharge]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(surcharge: Surcharge) = apply {
                            amount = surcharge.amount
                            currency = surcharge.currency
                            additionalProperties = surcharge.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Surcharge].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Surcharge =
                            Surcharge(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Surcharge = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Surcharge &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Surcharge{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /**
                 * The total amount of a series of incremental authorizations, optionally provided.
                 */
                class TotalCumulative
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [TotalCumulative].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [TotalCumulative]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(totalCumulative: TotalCumulative) = apply {
                            amount = totalCumulative.amount
                            currency = totalCumulative.currency
                            additionalProperties =
                                totalCumulative.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [TotalCumulative].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): TotalCumulative =
                            TotalCumulative(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): TotalCumulative = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is TotalCumulative &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "TotalCumulative{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The total amount of healthcare-related additional amounts. */
                class TotalHealthcare
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [TotalHealthcare].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [TotalHealthcare]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(totalHealthcare: TotalHealthcare) = apply {
                            amount = totalHealthcare.amount
                            currency = totalHealthcare.currency
                            additionalProperties =
                                totalHealthcare.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [TotalHealthcare].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): TotalHealthcare =
                            TotalHealthcare(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): TotalHealthcare = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is TotalHealthcare &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "TotalHealthcare{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for transit-related services. */
                class Transit
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Transit].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Transit]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(transit: Transit) = apply {
                            amount = transit.amount
                            currency = transit.currency
                            additionalProperties = transit.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Transit].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Transit =
                            Transit(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Transit = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Transit &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Transit{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** An unknown additional amount. */
                class Unknown
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Unknown].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Unknown]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(unknown: Unknown) = apply {
                            amount = unknown.amount
                            currency = unknown.currency
                            additionalProperties = unknown.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Unknown].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Unknown =
                            Unknown(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Unknown = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Unknown &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Unknown{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for vision-related services. */
                class Vision
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Vision].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Vision]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(vision: Vision) = apply {
                            amount = vision.amount
                            currency = vision.currency
                            additionalProperties = vision.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Vision].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Vision =
                            Vision(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Vision = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Vision &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Vision{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is AdditionalAmounts &&
                        clinic == other.clinic &&
                        dental == other.dental &&
                        original == other.original &&
                        prescription == other.prescription &&
                        surcharge == other.surcharge &&
                        totalCumulative == other.totalCumulative &&
                        totalHealthcare == other.totalHealthcare &&
                        transit == other.transit &&
                        unknown == other.unknown &&
                        vision == other.vision &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        clinic,
                        dental,
                        original,
                        prescription,
                        surcharge,
                        totalCumulative,
                        totalHealthcare,
                        transit,
                        unknown,
                        vision,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "AdditionalAmounts{clinic=$clinic, dental=$dental, original=$original, prescription=$prescription, surcharge=$surcharge, totalCumulative=$totalCumulative, totalHealthcare=$totalHealthcare, transit=$transit, unknown=$unknown, vision=$vision, additionalProperties=$additionalProperties}"
            }

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination
             * account currency.
             */
            class Currency @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** US Dollar (USD) */
                    @JvmField val USD = of("USD")

                    @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                }

                /** An enum containing [Currency]'s known values. */
                enum class Known {
                    /** US Dollar (USD) */
                    USD
                }

                /**
                 * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Currency] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** US Dollar (USD) */
                    USD,
                    /**
                     * An enum member indicating that [Currency] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        USD -> Value.USD
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        USD -> Known.USD
                        else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Currency = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Currency && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /**
             * The direction describes the direction the funds will move, either from the cardholder
             * to the merchant or from the merchant to the cardholder.
             */
            class Direction @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** A regular card authorization where funds are debited from the cardholder. */
                    @JvmField val SETTLEMENT = of("settlement")

                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    @JvmField val REFUND = of("refund")

                    @JvmStatic fun of(value: String) = Direction(JsonField.of(value))
                }

                /** An enum containing [Direction]'s known values. */
                enum class Known {
                    /** A regular card authorization where funds are debited from the cardholder. */
                    SETTLEMENT,
                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    REFUND,
                }

                /**
                 * An enum containing [Direction]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Direction] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** A regular card authorization where funds are debited from the cardholder. */
                    SETTLEMENT,
                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    REFUND,
                    /**
                     * An enum member indicating that [Direction] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        SETTLEMENT -> Value.SETTLEMENT
                        REFUND -> Value.REFUND
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        SETTLEMENT -> Known.SETTLEMENT
                        REFUND -> Known.REFUND
                        else -> throw IncreaseInvalidDataException("Unknown Direction: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Direction = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Direction && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** Fields specific to the `network`. */
            class NetworkDetails
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val category: JsonField<Category>,
                private val pulse: JsonField<Pulse>,
                private val visa: JsonField<Visa>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("category")
                    @ExcludeMissing
                    category: JsonField<Category> = JsonMissing.of(),
                    @JsonProperty("pulse")
                    @ExcludeMissing
                    pulse: JsonField<Pulse> = JsonMissing.of(),
                    @JsonProperty("visa") @ExcludeMissing visa: JsonField<Visa> = JsonMissing.of(),
                ) : this(category, pulse, visa, mutableMapOf())

                /**
                 * The payment network used to process this card authorization.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun category(): Category = category.getRequired("category")

                /**
                 * Fields specific to the `pulse` network.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun pulse(): Optional<Pulse> = pulse.getOptional("pulse")

                /**
                 * Fields specific to the `visa` network.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun visa(): Optional<Visa> = visa.getOptional("visa")

                /**
                 * Returns the raw JSON value of [category].
                 *
                 * Unlike [category], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("category")
                @ExcludeMissing
                fun _category(): JsonField<Category> = category

                /**
                 * Returns the raw JSON value of [pulse].
                 *
                 * Unlike [pulse], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("pulse") @ExcludeMissing fun _pulse(): JsonField<Pulse> = pulse

                /**
                 * Returns the raw JSON value of [visa].
                 *
                 * Unlike [visa], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("visa") @ExcludeMissing fun _visa(): JsonField<Visa> = visa

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [NetworkDetails].
                     *
                     * The following fields are required:
                     * ```java
                     * .category()
                     * .pulse()
                     * .visa()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [NetworkDetails]. */
                class Builder internal constructor() {

                    private var category: JsonField<Category>? = null
                    private var pulse: JsonField<Pulse>? = null
                    private var visa: JsonField<Visa>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(networkDetails: NetworkDetails) = apply {
                        category = networkDetails.category
                        pulse = networkDetails.pulse
                        visa = networkDetails.visa
                        additionalProperties = networkDetails.additionalProperties.toMutableMap()
                    }

                    /** The payment network used to process this card authorization. */
                    fun category(category: Category) = category(JsonField.of(category))

                    /**
                     * Sets [Builder.category] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.category] with a well-typed [Category] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun category(category: JsonField<Category>) = apply { this.category = category }

                    /** Fields specific to the `pulse` network. */
                    fun pulse(pulse: Pulse?) = pulse(JsonField.ofNullable(pulse))

                    /** Alias for calling [Builder.pulse] with `pulse.orElse(null)`. */
                    fun pulse(pulse: Optional<Pulse>) = pulse(pulse.getOrNull())

                    /**
                     * Sets [Builder.pulse] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.pulse] with a well-typed [Pulse] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun pulse(pulse: JsonField<Pulse>) = apply { this.pulse = pulse }

                    /** Fields specific to the `visa` network. */
                    fun visa(visa: Visa?) = visa(JsonField.ofNullable(visa))

                    /** Alias for calling [Builder.visa] with `visa.orElse(null)`. */
                    fun visa(visa: Optional<Visa>) = visa(visa.getOrNull())

                    /**
                     * Sets [Builder.visa] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.visa] with a well-typed [Visa] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun visa(visa: JsonField<Visa>) = apply { this.visa = visa }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [NetworkDetails].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .category()
                     * .pulse()
                     * .visa()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): NetworkDetails =
                        NetworkDetails(
                            checkRequired("category", category),
                            checkRequired("pulse", pulse),
                            checkRequired("visa", visa),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): NetworkDetails = apply {
                    if (validated) {
                        return@apply
                    }

                    category().validate()
                    pulse().ifPresent { it.validate() }
                    visa().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (category.asKnown().getOrNull()?.validity() ?: 0) +
                        (pulse.asKnown().getOrNull()?.validity() ?: 0) +
                        (visa.asKnown().getOrNull()?.validity() ?: 0)

                /** The payment network used to process this card authorization. */
                class Category
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** Visa */
                        @JvmField val VISA = of("visa")

                        /** Pulse */
                        @JvmField val PULSE = of("pulse")

                        @JvmStatic fun of(value: String) = Category(JsonField.of(value))
                    }

                    /** An enum containing [Category]'s known values. */
                    enum class Known {
                        /** Visa */
                        VISA,
                        /** Pulse */
                        PULSE,
                    }

                    /**
                     * An enum containing [Category]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Category] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** Visa */
                        VISA,
                        /** Pulse */
                        PULSE,
                        /**
                         * An enum member indicating that [Category] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            VISA -> Value.VISA
                            PULSE -> Value.PULSE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            VISA -> Known.VISA
                            PULSE -> Known.PULSE
                            else -> throw IncreaseInvalidDataException("Unknown Category: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Category = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Category && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** Fields specific to the `pulse` network. */
                class Pulse
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val additionalProperties: MutableMap<String, JsonValue>
                ) {

                    @JsonCreator private constructor() : this(mutableMapOf())

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /** Returns a mutable builder for constructing an instance of [Pulse]. */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Pulse]. */
                    class Builder internal constructor() {

                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(pulse: Pulse) = apply {
                            additionalProperties = pulse.additionalProperties.toMutableMap()
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Pulse].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         */
                        fun build(): Pulse = Pulse(additionalProperties.toMutableMap())
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Pulse = apply {
                        if (validated) {
                            return@apply
                        }

                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic internal fun validity(): Int = 0

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Pulse && additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy { Objects.hash(additionalProperties) }

                    override fun hashCode(): Int = hashCode

                    override fun toString() = "Pulse{additionalProperties=$additionalProperties}"
                }

                /** Fields specific to the `visa` network. */
                class Visa
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val electronicCommerceIndicator: JsonField<ElectronicCommerceIndicator>,
                    private val pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode>,
                    private val standInProcessingReason: JsonField<StandInProcessingReason>,
                    private val terminalEntryCapability: JsonField<TerminalEntryCapability>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("electronic_commerce_indicator")
                        @ExcludeMissing
                        electronicCommerceIndicator: JsonField<ElectronicCommerceIndicator> =
                            JsonMissing.of(),
                        @JsonProperty("point_of_service_entry_mode")
                        @ExcludeMissing
                        pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode> =
                            JsonMissing.of(),
                        @JsonProperty("stand_in_processing_reason")
                        @ExcludeMissing
                        standInProcessingReason: JsonField<StandInProcessingReason> =
                            JsonMissing.of(),
                        @JsonProperty("terminal_entry_capability")
                        @ExcludeMissing
                        terminalEntryCapability: JsonField<TerminalEntryCapability> =
                            JsonMissing.of(),
                    ) : this(
                        electronicCommerceIndicator,
                        pointOfServiceEntryMode,
                        standInProcessingReason,
                        terminalEntryCapability,
                        mutableMapOf(),
                    )

                    /**
                     * For electronic commerce transactions, this identifies the level of security
                     * used in obtaining the customer's payment credential. For mail or telephone
                     * order transactions, identifies the type of mail or telephone order.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun electronicCommerceIndicator(): Optional<ElectronicCommerceIndicator> =
                        electronicCommerceIndicator.getOptional("electronic_commerce_indicator")

                    /**
                     * The method used to enter the cardholder's primary account number and card
                     * expiration date.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun pointOfServiceEntryMode(): Optional<PointOfServiceEntryMode> =
                        pointOfServiceEntryMode.getOptional("point_of_service_entry_mode")

                    /**
                     * Only present when `actioner: network`. Describes why a card authorization was
                     * approved or declined by Visa through stand-in processing.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun standInProcessingReason(): Optional<StandInProcessingReason> =
                        standInProcessingReason.getOptional("stand_in_processing_reason")

                    /**
                     * The capability of the terminal being used to read the card. Shows whether a
                     * terminal can e.g., accept chip cards or if it only supports magnetic stripe
                     * reads. This reflects the highest capability of the terminal — for example, a
                     * terminal that supports both chip and magnetic stripe will be identified as
                     * chip-capable.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun terminalEntryCapability(): Optional<TerminalEntryCapability> =
                        terminalEntryCapability.getOptional("terminal_entry_capability")

                    /**
                     * Returns the raw JSON value of [electronicCommerceIndicator].
                     *
                     * Unlike [electronicCommerceIndicator], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("electronic_commerce_indicator")
                    @ExcludeMissing
                    fun _electronicCommerceIndicator(): JsonField<ElectronicCommerceIndicator> =
                        electronicCommerceIndicator

                    /**
                     * Returns the raw JSON value of [pointOfServiceEntryMode].
                     *
                     * Unlike [pointOfServiceEntryMode], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("point_of_service_entry_mode")
                    @ExcludeMissing
                    fun _pointOfServiceEntryMode(): JsonField<PointOfServiceEntryMode> =
                        pointOfServiceEntryMode

                    /**
                     * Returns the raw JSON value of [standInProcessingReason].
                     *
                     * Unlike [standInProcessingReason], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("stand_in_processing_reason")
                    @ExcludeMissing
                    fun _standInProcessingReason(): JsonField<StandInProcessingReason> =
                        standInProcessingReason

                    /**
                     * Returns the raw JSON value of [terminalEntryCapability].
                     *
                     * Unlike [terminalEntryCapability], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("terminal_entry_capability")
                    @ExcludeMissing
                    fun _terminalEntryCapability(): JsonField<TerminalEntryCapability> =
                        terminalEntryCapability

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Visa].
                         *
                         * The following fields are required:
                         * ```java
                         * .electronicCommerceIndicator()
                         * .pointOfServiceEntryMode()
                         * .standInProcessingReason()
                         * .terminalEntryCapability()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Visa]. */
                    class Builder internal constructor() {

                        private var electronicCommerceIndicator:
                            JsonField<ElectronicCommerceIndicator>? =
                            null
                        private var pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode>? =
                            null
                        private var standInProcessingReason: JsonField<StandInProcessingReason>? =
                            null
                        private var terminalEntryCapability: JsonField<TerminalEntryCapability>? =
                            null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(visa: Visa) = apply {
                            electronicCommerceIndicator = visa.electronicCommerceIndicator
                            pointOfServiceEntryMode = visa.pointOfServiceEntryMode
                            standInProcessingReason = visa.standInProcessingReason
                            terminalEntryCapability = visa.terminalEntryCapability
                            additionalProperties = visa.additionalProperties.toMutableMap()
                        }

                        /**
                         * For electronic commerce transactions, this identifies the level of
                         * security used in obtaining the customer's payment credential. For mail or
                         * telephone order transactions, identifies the type of mail or telephone
                         * order.
                         */
                        fun electronicCommerceIndicator(
                            electronicCommerceIndicator: ElectronicCommerceIndicator?
                        ) =
                            electronicCommerceIndicator(
                                JsonField.ofNullable(electronicCommerceIndicator)
                            )

                        /**
                         * Alias for calling [Builder.electronicCommerceIndicator] with
                         * `electronicCommerceIndicator.orElse(null)`.
                         */
                        fun electronicCommerceIndicator(
                            electronicCommerceIndicator: Optional<ElectronicCommerceIndicator>
                        ) = electronicCommerceIndicator(electronicCommerceIndicator.getOrNull())

                        /**
                         * Sets [Builder.electronicCommerceIndicator] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.electronicCommerceIndicator] with a
                         * well-typed [ElectronicCommerceIndicator] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun electronicCommerceIndicator(
                            electronicCommerceIndicator: JsonField<ElectronicCommerceIndicator>
                        ) = apply { this.electronicCommerceIndicator = electronicCommerceIndicator }

                        /**
                         * The method used to enter the cardholder's primary account number and card
                         * expiration date.
                         */
                        fun pointOfServiceEntryMode(
                            pointOfServiceEntryMode: PointOfServiceEntryMode?
                        ) = pointOfServiceEntryMode(JsonField.ofNullable(pointOfServiceEntryMode))

                        /**
                         * Alias for calling [Builder.pointOfServiceEntryMode] with
                         * `pointOfServiceEntryMode.orElse(null)`.
                         */
                        fun pointOfServiceEntryMode(
                            pointOfServiceEntryMode: Optional<PointOfServiceEntryMode>
                        ) = pointOfServiceEntryMode(pointOfServiceEntryMode.getOrNull())

                        /**
                         * Sets [Builder.pointOfServiceEntryMode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.pointOfServiceEntryMode] with a
                         * well-typed [PointOfServiceEntryMode] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun pointOfServiceEntryMode(
                            pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode>
                        ) = apply { this.pointOfServiceEntryMode = pointOfServiceEntryMode }

                        /**
                         * Only present when `actioner: network`. Describes why a card authorization
                         * was approved or declined by Visa through stand-in processing.
                         */
                        fun standInProcessingReason(
                            standInProcessingReason: StandInProcessingReason?
                        ) = standInProcessingReason(JsonField.ofNullable(standInProcessingReason))

                        /**
                         * Alias for calling [Builder.standInProcessingReason] with
                         * `standInProcessingReason.orElse(null)`.
                         */
                        fun standInProcessingReason(
                            standInProcessingReason: Optional<StandInProcessingReason>
                        ) = standInProcessingReason(standInProcessingReason.getOrNull())

                        /**
                         * Sets [Builder.standInProcessingReason] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.standInProcessingReason] with a
                         * well-typed [StandInProcessingReason] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun standInProcessingReason(
                            standInProcessingReason: JsonField<StandInProcessingReason>
                        ) = apply { this.standInProcessingReason = standInProcessingReason }

                        /**
                         * The capability of the terminal being used to read the card. Shows whether
                         * a terminal can e.g., accept chip cards or if it only supports magnetic
                         * stripe reads. This reflects the highest capability of the terminal — for
                         * example, a terminal that supports both chip and magnetic stripe will be
                         * identified as chip-capable.
                         */
                        fun terminalEntryCapability(
                            terminalEntryCapability: TerminalEntryCapability?
                        ) = terminalEntryCapability(JsonField.ofNullable(terminalEntryCapability))

                        /**
                         * Alias for calling [Builder.terminalEntryCapability] with
                         * `terminalEntryCapability.orElse(null)`.
                         */
                        fun terminalEntryCapability(
                            terminalEntryCapability: Optional<TerminalEntryCapability>
                        ) = terminalEntryCapability(terminalEntryCapability.getOrNull())

                        /**
                         * Sets [Builder.terminalEntryCapability] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.terminalEntryCapability] with a
                         * well-typed [TerminalEntryCapability] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun terminalEntryCapability(
                            terminalEntryCapability: JsonField<TerminalEntryCapability>
                        ) = apply { this.terminalEntryCapability = terminalEntryCapability }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Visa].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .electronicCommerceIndicator()
                         * .pointOfServiceEntryMode()
                         * .standInProcessingReason()
                         * .terminalEntryCapability()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Visa =
                            Visa(
                                checkRequired(
                                    "electronicCommerceIndicator",
                                    electronicCommerceIndicator,
                                ),
                                checkRequired("pointOfServiceEntryMode", pointOfServiceEntryMode),
                                checkRequired("standInProcessingReason", standInProcessingReason),
                                checkRequired("terminalEntryCapability", terminalEntryCapability),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Visa = apply {
                        if (validated) {
                            return@apply
                        }

                        electronicCommerceIndicator().ifPresent { it.validate() }
                        pointOfServiceEntryMode().ifPresent { it.validate() }
                        standInProcessingReason().ifPresent { it.validate() }
                        terminalEntryCapability().ifPresent { it.validate() }
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (electronicCommerceIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                            (pointOfServiceEntryMode.asKnown().getOrNull()?.validity() ?: 0) +
                            (standInProcessingReason.asKnown().getOrNull()?.validity() ?: 0) +
                            (terminalEntryCapability.asKnown().getOrNull()?.validity() ?: 0)

                    /**
                     * For electronic commerce transactions, this identifies the level of security
                     * used in obtaining the customer's payment credential. For mail or telephone
                     * order transactions, identifies the type of mail or telephone order.
                     */
                    class ElectronicCommerceIndicator
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /**
                             * Single transaction of a mail/phone order: Use to indicate that the
                             * transaction is a mail/phone order purchase, not a recurring
                             * transaction or installment payment. For domestic transactions in the
                             * US region, this value may also indicate one bill payment transaction
                             * in the card-present or card-absent environments.
                             */
                            @JvmField val MAIL_PHONE_ORDER = of("mail_phone_order")

                            /**
                             * Recurring transaction: Payment indicator used to indicate a recurring
                             * transaction that originates from an acquirer in the US region.
                             */
                            @JvmField val RECURRING = of("recurring")

                            /**
                             * Installment payment: Payment indicator used to indicate one purchase
                             * of goods or services that is billed to the account in multiple
                             * charges over a period of time agreed upon by the cardholder and
                             * merchant from transactions that originate from an acquirer in the US
                             * region.
                             */
                            @JvmField val INSTALLMENT = of("installment")

                            /**
                             * Unknown classification: other mail order: Use to indicate that the
                             * type of mail/telephone order is unknown.
                             */
                            @JvmField val UNKNOWN_MAIL_PHONE_ORDER = of("unknown_mail_phone_order")

                            /**
                             * Secure electronic commerce transaction: Use to indicate that the
                             * electronic commerce transaction has been authenticated using e.g.,
                             * 3-D Secure
                             */
                            @JvmField
                            val SECURE_ELECTRONIC_COMMERCE = of("secure_electronic_commerce")

                            /**
                             * Non-authenticated security transaction at a 3-D Secure-capable
                             * merchant, and merchant attempted to authenticate the cardholder using
                             * 3-D Secure: Use to identify an electronic commerce transaction where
                             * the merchant attempted to authenticate the cardholder using 3-D
                             * Secure, but was unable to complete the authentication because the
                             * issuer or cardholder does not participate in the 3-D Secure program.
                             */
                            @JvmField
                            val NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT =
                                of("non_authenticated_security_transaction_at_3ds_capable_merchant")

                            /**
                             * Non-authenticated security transaction: Use to identify an electronic
                             * commerce transaction that uses data encryption for security however,
                             * cardholder authentication is not performed using 3-D Secure.
                             */
                            @JvmField
                            val NON_AUTHENTICATED_SECURITY_TRANSACTION =
                                of("non_authenticated_security_transaction")

                            /**
                             * Non-secure transaction: Use to identify an electronic commerce
                             * transaction that has no data protection.
                             */
                            @JvmField val NON_SECURE_TRANSACTION = of("non_secure_transaction")

                            @JvmStatic
                            fun of(value: String) = ElectronicCommerceIndicator(JsonField.of(value))
                        }

                        /** An enum containing [ElectronicCommerceIndicator]'s known values. */
                        enum class Known {
                            /**
                             * Single transaction of a mail/phone order: Use to indicate that the
                             * transaction is a mail/phone order purchase, not a recurring
                             * transaction or installment payment. For domestic transactions in the
                             * US region, this value may also indicate one bill payment transaction
                             * in the card-present or card-absent environments.
                             */
                            MAIL_PHONE_ORDER,
                            /**
                             * Recurring transaction: Payment indicator used to indicate a recurring
                             * transaction that originates from an acquirer in the US region.
                             */
                            RECURRING,
                            /**
                             * Installment payment: Payment indicator used to indicate one purchase
                             * of goods or services that is billed to the account in multiple
                             * charges over a period of time agreed upon by the cardholder and
                             * merchant from transactions that originate from an acquirer in the US
                             * region.
                             */
                            INSTALLMENT,
                            /**
                             * Unknown classification: other mail order: Use to indicate that the
                             * type of mail/telephone order is unknown.
                             */
                            UNKNOWN_MAIL_PHONE_ORDER,
                            /**
                             * Secure electronic commerce transaction: Use to indicate that the
                             * electronic commerce transaction has been authenticated using e.g.,
                             * 3-D Secure
                             */
                            SECURE_ELECTRONIC_COMMERCE,
                            /**
                             * Non-authenticated security transaction at a 3-D Secure-capable
                             * merchant, and merchant attempted to authenticate the cardholder using
                             * 3-D Secure: Use to identify an electronic commerce transaction where
                             * the merchant attempted to authenticate the cardholder using 3-D
                             * Secure, but was unable to complete the authentication because the
                             * issuer or cardholder does not participate in the 3-D Secure program.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT,
                            /**
                             * Non-authenticated security transaction: Use to identify an electronic
                             * commerce transaction that uses data encryption for security however,
                             * cardholder authentication is not performed using 3-D Secure.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION,
                            /**
                             * Non-secure transaction: Use to identify an electronic commerce
                             * transaction that has no data protection.
                             */
                            NON_SECURE_TRANSACTION,
                        }

                        /**
                         * An enum containing [ElectronicCommerceIndicator]'s known values, as well
                         * as an [_UNKNOWN] member.
                         *
                         * An instance of [ElectronicCommerceIndicator] can contain an unknown value
                         * in a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /**
                             * Single transaction of a mail/phone order: Use to indicate that the
                             * transaction is a mail/phone order purchase, not a recurring
                             * transaction or installment payment. For domestic transactions in the
                             * US region, this value may also indicate one bill payment transaction
                             * in the card-present or card-absent environments.
                             */
                            MAIL_PHONE_ORDER,
                            /**
                             * Recurring transaction: Payment indicator used to indicate a recurring
                             * transaction that originates from an acquirer in the US region.
                             */
                            RECURRING,
                            /**
                             * Installment payment: Payment indicator used to indicate one purchase
                             * of goods or services that is billed to the account in multiple
                             * charges over a period of time agreed upon by the cardholder and
                             * merchant from transactions that originate from an acquirer in the US
                             * region.
                             */
                            INSTALLMENT,
                            /**
                             * Unknown classification: other mail order: Use to indicate that the
                             * type of mail/telephone order is unknown.
                             */
                            UNKNOWN_MAIL_PHONE_ORDER,
                            /**
                             * Secure electronic commerce transaction: Use to indicate that the
                             * electronic commerce transaction has been authenticated using e.g.,
                             * 3-D Secure
                             */
                            SECURE_ELECTRONIC_COMMERCE,
                            /**
                             * Non-authenticated security transaction at a 3-D Secure-capable
                             * merchant, and merchant attempted to authenticate the cardholder using
                             * 3-D Secure: Use to identify an electronic commerce transaction where
                             * the merchant attempted to authenticate the cardholder using 3-D
                             * Secure, but was unable to complete the authentication because the
                             * issuer or cardholder does not participate in the 3-D Secure program.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT,
                            /**
                             * Non-authenticated security transaction: Use to identify an electronic
                             * commerce transaction that uses data encryption for security however,
                             * cardholder authentication is not performed using 3-D Secure.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION,
                            /**
                             * Non-secure transaction: Use to identify an electronic commerce
                             * transaction that has no data protection.
                             */
                            NON_SECURE_TRANSACTION,
                            /**
                             * An enum member indicating that [ElectronicCommerceIndicator] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                MAIL_PHONE_ORDER -> Value.MAIL_PHONE_ORDER
                                RECURRING -> Value.RECURRING
                                INSTALLMENT -> Value.INSTALLMENT
                                UNKNOWN_MAIL_PHONE_ORDER -> Value.UNKNOWN_MAIL_PHONE_ORDER
                                SECURE_ELECTRONIC_COMMERCE -> Value.SECURE_ELECTRONIC_COMMERCE
                                NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT ->
                                    Value
                                        .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT
                                NON_AUTHENTICATED_SECURITY_TRANSACTION ->
                                    Value.NON_AUTHENTICATED_SECURITY_TRANSACTION
                                NON_SECURE_TRANSACTION -> Value.NON_SECURE_TRANSACTION
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                MAIL_PHONE_ORDER -> Known.MAIL_PHONE_ORDER
                                RECURRING -> Known.RECURRING
                                INSTALLMENT -> Known.INSTALLMENT
                                UNKNOWN_MAIL_PHONE_ORDER -> Known.UNKNOWN_MAIL_PHONE_ORDER
                                SECURE_ELECTRONIC_COMMERCE -> Known.SECURE_ELECTRONIC_COMMERCE
                                NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT ->
                                    Known
                                        .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT
                                NON_AUTHENTICATED_SECURITY_TRANSACTION ->
                                    Known.NON_AUTHENTICATED_SECURITY_TRANSACTION
                                NON_SECURE_TRANSACTION -> Known.NON_SECURE_TRANSACTION
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown ElectronicCommerceIndicator: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): ElectronicCommerceIndicator = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is ElectronicCommerceIndicator && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * The method used to enter the cardholder's primary account number and card
                     * expiration date.
                     */
                    class PointOfServiceEntryMode
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Unknown */
                            @JvmField val UNKNOWN = of("unknown")

                            /** Manual key entry */
                            @JvmField val MANUAL = of("manual")

                            /** Magnetic stripe read, without card verification value */
                            @JvmField val MAGNETIC_STRIPE_NO_CVV = of("magnetic_stripe_no_cvv")

                            /** Optical code */
                            @JvmField val OPTICAL_CODE = of("optical_code")

                            /** Contact chip card */
                            @JvmField val INTEGRATED_CIRCUIT_CARD = of("integrated_circuit_card")

                            /** Contactless read of chip card */
                            @JvmField val CONTACTLESS = of("contactless")

                            /**
                             * Transaction initiated using a credential that has previously been
                             * stored on file
                             */
                            @JvmField val CREDENTIAL_ON_FILE = of("credential_on_file")

                            /** Magnetic stripe read */
                            @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe")

                            /** Contactless read of magnetic stripe data */
                            @JvmField
                            val CONTACTLESS_MAGNETIC_STRIPE = of("contactless_magnetic_stripe")

                            /** Contact chip card, without card verification value */
                            @JvmField
                            val INTEGRATED_CIRCUIT_CARD_NO_CVV =
                                of("integrated_circuit_card_no_cvv")

                            @JvmStatic
                            fun of(value: String) = PointOfServiceEntryMode(JsonField.of(value))
                        }

                        /** An enum containing [PointOfServiceEntryMode]'s known values. */
                        enum class Known {
                            /** Unknown */
                            UNKNOWN,
                            /** Manual key entry */
                            MANUAL,
                            /** Magnetic stripe read, without card verification value */
                            MAGNETIC_STRIPE_NO_CVV,
                            /** Optical code */
                            OPTICAL_CODE,
                            /** Contact chip card */
                            INTEGRATED_CIRCUIT_CARD,
                            /** Contactless read of chip card */
                            CONTACTLESS,
                            /**
                             * Transaction initiated using a credential that has previously been
                             * stored on file
                             */
                            CREDENTIAL_ON_FILE,
                            /** Magnetic stripe read */
                            MAGNETIC_STRIPE,
                            /** Contactless read of magnetic stripe data */
                            CONTACTLESS_MAGNETIC_STRIPE,
                            /** Contact chip card, without card verification value */
                            INTEGRATED_CIRCUIT_CARD_NO_CVV,
                        }

                        /**
                         * An enum containing [PointOfServiceEntryMode]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [PointOfServiceEntryMode] can contain an unknown value in
                         * a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Unknown */
                            UNKNOWN,
                            /** Manual key entry */
                            MANUAL,
                            /** Magnetic stripe read, without card verification value */
                            MAGNETIC_STRIPE_NO_CVV,
                            /** Optical code */
                            OPTICAL_CODE,
                            /** Contact chip card */
                            INTEGRATED_CIRCUIT_CARD,
                            /** Contactless read of chip card */
                            CONTACTLESS,
                            /**
                             * Transaction initiated using a credential that has previously been
                             * stored on file
                             */
                            CREDENTIAL_ON_FILE,
                            /** Magnetic stripe read */
                            MAGNETIC_STRIPE,
                            /** Contactless read of magnetic stripe data */
                            CONTACTLESS_MAGNETIC_STRIPE,
                            /** Contact chip card, without card verification value */
                            INTEGRATED_CIRCUIT_CARD_NO_CVV,
                            /**
                             * An enum member indicating that [PointOfServiceEntryMode] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                UNKNOWN -> Value.UNKNOWN
                                MANUAL -> Value.MANUAL
                                MAGNETIC_STRIPE_NO_CVV -> Value.MAGNETIC_STRIPE_NO_CVV
                                OPTICAL_CODE -> Value.OPTICAL_CODE
                                INTEGRATED_CIRCUIT_CARD -> Value.INTEGRATED_CIRCUIT_CARD
                                CONTACTLESS -> Value.CONTACTLESS
                                CREDENTIAL_ON_FILE -> Value.CREDENTIAL_ON_FILE
                                MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE
                                CONTACTLESS_MAGNETIC_STRIPE -> Value.CONTACTLESS_MAGNETIC_STRIPE
                                INTEGRATED_CIRCUIT_CARD_NO_CVV ->
                                    Value.INTEGRATED_CIRCUIT_CARD_NO_CVV
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                UNKNOWN -> Known.UNKNOWN
                                MANUAL -> Known.MANUAL
                                MAGNETIC_STRIPE_NO_CVV -> Known.MAGNETIC_STRIPE_NO_CVV
                                OPTICAL_CODE -> Known.OPTICAL_CODE
                                INTEGRATED_CIRCUIT_CARD -> Known.INTEGRATED_CIRCUIT_CARD
                                CONTACTLESS -> Known.CONTACTLESS
                                CREDENTIAL_ON_FILE -> Known.CREDENTIAL_ON_FILE
                                MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE
                                CONTACTLESS_MAGNETIC_STRIPE -> Known.CONTACTLESS_MAGNETIC_STRIPE
                                INTEGRATED_CIRCUIT_CARD_NO_CVV ->
                                    Known.INTEGRATED_CIRCUIT_CARD_NO_CVV
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown PointOfServiceEntryMode: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): PointOfServiceEntryMode = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is PointOfServiceEntryMode && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * Only present when `actioner: network`. Describes why a card authorization was
                     * approved or declined by Visa through stand-in processing.
                     */
                    class StandInProcessingReason
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Increase failed to process the authorization in a timely manner. */
                            @JvmField val ISSUER_ERROR = of("issuer_error")

                            /** The physical card read had an invalid CVV or dCVV. */
                            @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card")

                            /**
                             * The card's authorization request cryptogram was invalid. The
                             * cryptogram can be from a physical card or a Digital Wallet Token
                             * purchase.
                             */
                            @JvmField val INVALID_CRYPTOGRAM = of("invalid_cryptogram")

                            /** The 3DS cardholder authentication verification value was invalid. */
                            @JvmField
                            val INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE =
                                of("invalid_cardholder_authentication_verification_value")

                            /**
                             * An internal Visa error occurred. Visa uses this reason code for
                             * certain expected occurrences as well, such as Application Transaction
                             * Counter (ATC) replays.
                             */
                            @JvmField val INTERNAL_VISA_ERROR = of("internal_visa_error")

                            /**
                             * The merchant has enabled Visa's Transaction Advisory Service and
                             * requires further authentication to perform the transaction. In
                             * practice this is often utilized at fuel pumps to tell the cardholder
                             * to see the cashier.
                             */
                            @JvmField
                            val MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED =
                                of("merchant_transaction_advisory_service_authentication_required")

                            /**
                             * The transaction was blocked by Visa's Payment Fraud Disruption
                             * service due to fraudulent Acquirer behavior, such as card testing.
                             */
                            @JvmField
                            val PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK =
                                of("payment_fraud_disruption_acquirer_block")

                            /** An unspecific reason for stand-in processing. */
                            @JvmField val OTHER = of("other")

                            @JvmStatic
                            fun of(value: String) = StandInProcessingReason(JsonField.of(value))
                        }

                        /** An enum containing [StandInProcessingReason]'s known values. */
                        enum class Known {
                            /** Increase failed to process the authorization in a timely manner. */
                            ISSUER_ERROR,
                            /** The physical card read had an invalid CVV or dCVV. */
                            INVALID_PHYSICAL_CARD,
                            /**
                             * The card's authorization request cryptogram was invalid. The
                             * cryptogram can be from a physical card or a Digital Wallet Token
                             * purchase.
                             */
                            INVALID_CRYPTOGRAM,
                            /** The 3DS cardholder authentication verification value was invalid. */
                            INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE,
                            /**
                             * An internal Visa error occurred. Visa uses this reason code for
                             * certain expected occurrences as well, such as Application Transaction
                             * Counter (ATC) replays.
                             */
                            INTERNAL_VISA_ERROR,
                            /**
                             * The merchant has enabled Visa's Transaction Advisory Service and
                             * requires further authentication to perform the transaction. In
                             * practice this is often utilized at fuel pumps to tell the cardholder
                             * to see the cashier.
                             */
                            MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED,
                            /**
                             * The transaction was blocked by Visa's Payment Fraud Disruption
                             * service due to fraudulent Acquirer behavior, such as card testing.
                             */
                            PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK,
                            /** An unspecific reason for stand-in processing. */
                            OTHER,
                        }

                        /**
                         * An enum containing [StandInProcessingReason]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [StandInProcessingReason] can contain an unknown value in
                         * a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Increase failed to process the authorization in a timely manner. */
                            ISSUER_ERROR,
                            /** The physical card read had an invalid CVV or dCVV. */
                            INVALID_PHYSICAL_CARD,
                            /**
                             * The card's authorization request cryptogram was invalid. The
                             * cryptogram can be from a physical card or a Digital Wallet Token
                             * purchase.
                             */
                            INVALID_CRYPTOGRAM,
                            /** The 3DS cardholder authentication verification value was invalid. */
                            INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE,
                            /**
                             * An internal Visa error occurred. Visa uses this reason code for
                             * certain expected occurrences as well, such as Application Transaction
                             * Counter (ATC) replays.
                             */
                            INTERNAL_VISA_ERROR,
                            /**
                             * The merchant has enabled Visa's Transaction Advisory Service and
                             * requires further authentication to perform the transaction. In
                             * practice this is often utilized at fuel pumps to tell the cardholder
                             * to see the cashier.
                             */
                            MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED,
                            /**
                             * The transaction was blocked by Visa's Payment Fraud Disruption
                             * service due to fraudulent Acquirer behavior, such as card testing.
                             */
                            PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK,
                            /** An unspecific reason for stand-in processing. */
                            OTHER,
                            /**
                             * An enum member indicating that [StandInProcessingReason] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                ISSUER_ERROR -> Value.ISSUER_ERROR
                                INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD
                                INVALID_CRYPTOGRAM -> Value.INVALID_CRYPTOGRAM
                                INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE ->
                                    Value.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE
                                INTERNAL_VISA_ERROR -> Value.INTERNAL_VISA_ERROR
                                MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED ->
                                    Value
                                        .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED
                                PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK ->
                                    Value.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK
                                OTHER -> Value.OTHER
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                ISSUER_ERROR -> Known.ISSUER_ERROR
                                INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD
                                INVALID_CRYPTOGRAM -> Known.INVALID_CRYPTOGRAM
                                INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE ->
                                    Known.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE
                                INTERNAL_VISA_ERROR -> Known.INTERNAL_VISA_ERROR
                                MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED ->
                                    Known
                                        .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED
                                PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK ->
                                    Known.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK
                                OTHER -> Known.OTHER
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown StandInProcessingReason: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): StandInProcessingReason = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is StandInProcessingReason && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * The capability of the terminal being used to read the card. Shows whether a
                     * terminal can e.g., accept chip cards or if it only supports magnetic stripe
                     * reads. This reflects the highest capability of the terminal — for example, a
                     * terminal that supports both chip and magnetic stripe will be identified as
                     * chip-capable.
                     */
                    class TerminalEntryCapability
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Unknown */
                            @JvmField val UNKNOWN = of("unknown")

                            /** No terminal was used for this transaction. */
                            @JvmField val TERMINAL_NOT_USED = of("terminal_not_used")

                            /**
                             * The terminal can only read magnetic stripes and does not have chip or
                             * contactless reading capability.
                             */
                            @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe")

                            /** The terminal can only read barcodes. */
                            @JvmField val BARCODE = of("barcode")

                            /**
                             * The terminal can only read cards via Optical Character Recognition.
                             */
                            @JvmField
                            val OPTICAL_CHARACTER_RECOGNITION = of("optical_character_recognition")

                            /**
                             * The terminal supports contact chip cards and can also read the
                             * magnetic stripe. If contact chip is supported, this value is used
                             * regardless of whether contactless is also supported.
                             */
                            @JvmField val CHIP_OR_CONTACTLESS = of("chip_or_contactless")

                            /**
                             * The terminal supports contactless reads but does not support contact
                             * chip. Only used when the terminal lacks contact chip capability.
                             */
                            @JvmField val CONTACTLESS_ONLY = of("contactless_only")

                            /** The terminal has no card reading capability. */
                            @JvmField val NO_CAPABILITY = of("no_capability")

                            @JvmStatic
                            fun of(value: String) = TerminalEntryCapability(JsonField.of(value))
                        }

                        /** An enum containing [TerminalEntryCapability]'s known values. */
                        enum class Known {
                            /** Unknown */
                            UNKNOWN,
                            /** No terminal was used for this transaction. */
                            TERMINAL_NOT_USED,
                            /**
                             * The terminal can only read magnetic stripes and does not have chip or
                             * contactless reading capability.
                             */
                            MAGNETIC_STRIPE,
                            /** The terminal can only read barcodes. */
                            BARCODE,
                            /**
                             * The terminal can only read cards via Optical Character Recognition.
                             */
                            OPTICAL_CHARACTER_RECOGNITION,
                            /**
                             * The terminal supports contact chip cards and can also read the
                             * magnetic stripe. If contact chip is supported, this value is used
                             * regardless of whether contactless is also supported.
                             */
                            CHIP_OR_CONTACTLESS,
                            /**
                             * The terminal supports contactless reads but does not support contact
                             * chip. Only used when the terminal lacks contact chip capability.
                             */
                            CONTACTLESS_ONLY,
                            /** The terminal has no card reading capability. */
                            NO_CAPABILITY,
                        }

                        /**
                         * An enum containing [TerminalEntryCapability]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [TerminalEntryCapability] can contain an unknown value in
                         * a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Unknown */
                            UNKNOWN,
                            /** No terminal was used for this transaction. */
                            TERMINAL_NOT_USED,
                            /**
                             * The terminal can only read magnetic stripes and does not have chip or
                             * contactless reading capability.
                             */
                            MAGNETIC_STRIPE,
                            /** The terminal can only read barcodes. */
                            BARCODE,
                            /**
                             * The terminal can only read cards via Optical Character Recognition.
                             */
                            OPTICAL_CHARACTER_RECOGNITION,
                            /**
                             * The terminal supports contact chip cards and can also read the
                             * magnetic stripe. If contact chip is supported, this value is used
                             * regardless of whether contactless is also supported.
                             */
                            CHIP_OR_CONTACTLESS,
                            /**
                             * The terminal supports contactless reads but does not support contact
                             * chip. Only used when the terminal lacks contact chip capability.
                             */
                            CONTACTLESS_ONLY,
                            /** The terminal has no card reading capability. */
                            NO_CAPABILITY,
                            /**
                             * An enum member indicating that [TerminalEntryCapability] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                UNKNOWN -> Value.UNKNOWN
                                TERMINAL_NOT_USED -> Value.TERMINAL_NOT_USED
                                MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE
                                BARCODE -> Value.BARCODE
                                OPTICAL_CHARACTER_RECOGNITION -> Value.OPTICAL_CHARACTER_RECOGNITION
                                CHIP_OR_CONTACTLESS -> Value.CHIP_OR_CONTACTLESS
                                CONTACTLESS_ONLY -> Value.CONTACTLESS_ONLY
                                NO_CAPABILITY -> Value.NO_CAPABILITY
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                UNKNOWN -> Known.UNKNOWN
                                TERMINAL_NOT_USED -> Known.TERMINAL_NOT_USED
                                MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE
                                BARCODE -> Known.BARCODE
                                OPTICAL_CHARACTER_RECOGNITION -> Known.OPTICAL_CHARACTER_RECOGNITION
                                CHIP_OR_CONTACTLESS -> Known.CHIP_OR_CONTACTLESS
                                CONTACTLESS_ONLY -> Known.CONTACTLESS_ONLY
                                NO_CAPABILITY -> Known.NO_CAPABILITY
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown TerminalEntryCapability: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): TerminalEntryCapability = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is TerminalEntryCapability && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Visa &&
                            electronicCommerceIndicator == other.electronicCommerceIndicator &&
                            pointOfServiceEntryMode == other.pointOfServiceEntryMode &&
                            standInProcessingReason == other.standInProcessingReason &&
                            terminalEntryCapability == other.terminalEntryCapability &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            electronicCommerceIndicator,
                            pointOfServiceEntryMode,
                            standInProcessingReason,
                            terminalEntryCapability,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Visa{electronicCommerceIndicator=$electronicCommerceIndicator, pointOfServiceEntryMode=$pointOfServiceEntryMode, standInProcessingReason=$standInProcessingReason, terminalEntryCapability=$terminalEntryCapability, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is NetworkDetails &&
                        category == other.category &&
                        pulse == other.pulse &&
                        visa == other.visa &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(category, pulse, visa, additionalProperties)
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "NetworkDetails{category=$category, pulse=$pulse, visa=$visa, additionalProperties=$additionalProperties}"
            }

            /** Network-specific identifiers for a specific request or transaction. */
            class NetworkIdentifiers
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val authorizationIdentificationResponse: JsonField<String>,
                private val retrievalReferenceNumber: JsonField<String>,
                private val traceNumber: JsonField<String>,
                private val transactionId: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("authorization_identification_response")
                    @ExcludeMissing
                    authorizationIdentificationResponse: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("retrieval_reference_number")
                    @ExcludeMissing
                    retrievalReferenceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("trace_number")
                    @ExcludeMissing
                    traceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("transaction_id")
                    @ExcludeMissing
                    transactionId: JsonField<String> = JsonMissing.of(),
                ) : this(
                    authorizationIdentificationResponse,
                    retrievalReferenceNumber,
                    traceNumber,
                    transactionId,
                    mutableMapOf(),
                )

                /**
                 * The randomly generated 6-character Authorization Identification Response code
                 * sent back to the acquirer in an approved response.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun authorizationIdentificationResponse(): Optional<String> =
                    authorizationIdentificationResponse.getOptional(
                        "authorization_identification_response"
                    )

                /**
                 * A life-cycle identifier used across e.g., an authorization and a reversal.
                 * Expected to be unique per acquirer within a window of time. For some card
                 * networks the retrieval reference number includes the trace counter.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun retrievalReferenceNumber(): Optional<String> =
                    retrievalReferenceNumber.getOptional("retrieval_reference_number")

                /**
                 * A counter used to verify an individual authorization. Expected to be unique per
                 * acquirer within a window of time.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun traceNumber(): Optional<String> = traceNumber.getOptional("trace_number")

                /**
                 * A globally unique transaction identifier provided by the card network, used
                 * across multiple life-cycle requests.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun transactionId(): Optional<String> = transactionId.getOptional("transaction_id")

                /**
                 * Returns the raw JSON value of [authorizationIdentificationResponse].
                 *
                 * Unlike [authorizationIdentificationResponse], this method doesn't throw if the
                 * JSON field has an unexpected type.
                 */
                @JsonProperty("authorization_identification_response")
                @ExcludeMissing
                fun _authorizationIdentificationResponse(): JsonField<String> =
                    authorizationIdentificationResponse

                /**
                 * Returns the raw JSON value of [retrievalReferenceNumber].
                 *
                 * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field
                 * has an unexpected type.
                 */
                @JsonProperty("retrieval_reference_number")
                @ExcludeMissing
                fun _retrievalReferenceNumber(): JsonField<String> = retrievalReferenceNumber

                /**
                 * Returns the raw JSON value of [traceNumber].
                 *
                 * Unlike [traceNumber], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("trace_number")
                @ExcludeMissing
                fun _traceNumber(): JsonField<String> = traceNumber

                /**
                 * Returns the raw JSON value of [transactionId].
                 *
                 * Unlike [transactionId], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("transaction_id")
                @ExcludeMissing
                fun _transactionId(): JsonField<String> = transactionId

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of
                     * [NetworkIdentifiers].
                     *
                     * The following fields are required:
                     * ```java
                     * .authorizationIdentificationResponse()
                     * .retrievalReferenceNumber()
                     * .traceNumber()
                     * .transactionId()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [NetworkIdentifiers]. */
                class Builder internal constructor() {

                    private var authorizationIdentificationResponse: JsonField<String>? = null
                    private var retrievalReferenceNumber: JsonField<String>? = null
                    private var traceNumber: JsonField<String>? = null
                    private var transactionId: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(networkIdentifiers: NetworkIdentifiers) = apply {
                        authorizationIdentificationResponse =
                            networkIdentifiers.authorizationIdentificationResponse
                        retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber
                        traceNumber = networkIdentifiers.traceNumber
                        transactionId = networkIdentifiers.transactionId
                        additionalProperties =
                            networkIdentifiers.additionalProperties.toMutableMap()
                    }

                    /**
                     * The randomly generated 6-character Authorization Identification Response code
                     * sent back to the acquirer in an approved response.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: String?
                    ) =
                        authorizationIdentificationResponse(
                            JsonField.ofNullable(authorizationIdentificationResponse)
                        )

                    /**
                     * Alias for calling [Builder.authorizationIdentificationResponse] with
                     * `authorizationIdentificationResponse.orElse(null)`.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: Optional<String>
                    ) =
                        authorizationIdentificationResponse(
                            authorizationIdentificationResponse.getOrNull()
                        )

                    /**
                     * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON
                     * value.
                     *
                     * You should usually call [Builder.authorizationIdentificationResponse] with a
                     * well-typed [String] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: JsonField<String>
                    ) = apply {
                        this.authorizationIdentificationResponse =
                            authorizationIdentificationResponse
                    }

                    /**
                     * A life-cycle identifier used across e.g., an authorization and a reversal.
                     * Expected to be unique per acquirer within a window of time. For some card
                     * networks the retrieval reference number includes the trace counter.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: String?) =
                        retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber))

                    /**
                     * Alias for calling [Builder.retrievalReferenceNumber] with
                     * `retrievalReferenceNumber.orElse(null)`.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: Optional<String>) =
                        retrievalReferenceNumber(retrievalReferenceNumber.getOrNull())

                    /**
                     * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.retrievalReferenceNumber] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField<String>) =
                        apply {
                            this.retrievalReferenceNumber = retrievalReferenceNumber
                        }

                    /**
                     * A counter used to verify an individual authorization. Expected to be unique
                     * per acquirer within a window of time.
                     */
                    fun traceNumber(traceNumber: String?) =
                        traceNumber(JsonField.ofNullable(traceNumber))

                    /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */
                    fun traceNumber(traceNumber: Optional<String>) =
                        traceNumber(traceNumber.getOrNull())

                    /**
                     * Sets [Builder.traceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.traceNumber] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun traceNumber(traceNumber: JsonField<String>) = apply {
                        this.traceNumber = traceNumber
                    }

                    /**
                     * A globally unique transaction identifier provided by the card network, used
                     * across multiple life-cycle requests.
                     */
                    fun transactionId(transactionId: String?) =
                        transactionId(JsonField.ofNullable(transactionId))

                    /**
                     * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`.
                     */
                    fun transactionId(transactionId: Optional<String>) =
                        transactionId(transactionId.getOrNull())

                    /**
                     * Sets [Builder.transactionId] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.transactionId] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun transactionId(transactionId: JsonField<String>) = apply {
                        this.transactionId = transactionId
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [NetworkIdentifiers].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .authorizationIdentificationResponse()
                     * .retrievalReferenceNumber()
                     * .traceNumber()
                     * .transactionId()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): NetworkIdentifiers =
                        NetworkIdentifiers(
                            checkRequired(
                                "authorizationIdentificationResponse",
                                authorizationIdentificationResponse,
                            ),
                            checkRequired("retrievalReferenceNumber", retrievalReferenceNumber),
                            checkRequired("traceNumber", traceNumber),
                            checkRequired("transactionId", transactionId),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): NetworkIdentifiers = apply {
                    if (validated) {
                        return@apply
                    }

                    authorizationIdentificationResponse()
                    retrievalReferenceNumber()
                    traceNumber()
                    transactionId()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) +
                        (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) +
                        (if (traceNumber.asKnown().isPresent) 1 else 0) +
                        (if (transactionId.asKnown().isPresent) 1 else 0)

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is NetworkIdentifiers &&
                        authorizationIdentificationResponse ==
                            other.authorizationIdentificationResponse &&
                        retrievalReferenceNumber == other.retrievalReferenceNumber &&
                        traceNumber == other.traceNumber &&
                        transactionId == other.transactionId &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        authorizationIdentificationResponse,
                        retrievalReferenceNumber,
                        traceNumber,
                        transactionId,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}"
            }

            /**
             * The processing category describes the intent behind the authorization, such as
             * whether it was used for bill payments or an automatic fuel dispenser.
             */
            class ProcessingCategory
            @JsonCreator
            private constructor(private val value: JsonField<String>) : Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /**
                     * Account funding transactions are transactions used to e.g., fund an account
                     * or transfer funds between accounts.
                     */
                    @JvmField val ACCOUNT_FUNDING = of("account_funding")

                    /**
                     * Automatic fuel dispenser authorizations occur when a card is used at a gas
                     * pump, prior to the actual transaction amount being known. They are followed
                     * by an advice message that updates the amount of the pending transaction.
                     */
                    @JvmField val AUTOMATIC_FUEL_DISPENSER = of("automatic_fuel_dispenser")

                    /** A transaction used to pay a bill. */
                    @JvmField val BILL_PAYMENT = of("bill_payment")

                    /** Original credit transactions are used to send money to a cardholder. */
                    @JvmField val ORIGINAL_CREDIT = of("original_credit")

                    /** A regular purchase. */
                    @JvmField val PURCHASE = of("purchase")

                    /**
                     * Quasi-cash transactions represent purchases of items which may be convertible
                     * to cash.
                     */
                    @JvmField val QUASI_CASH = of("quasi_cash")

                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    @JvmField val REFUND = of("refund")

                    /**
                     * Cash disbursement transactions are used to withdraw cash from an ATM or a
                     * point of sale.
                     */
                    @JvmField val CASH_DISBURSEMENT = of("cash_disbursement")

                    /**
                     * Cash deposit transactions are used to deposit cash at an ATM or a point of
                     * sale.
                     */
                    @JvmField val CASH_DEPOSIT = of("cash_deposit")

                    /**
                     * A balance inquiry transaction is used to check the balance of an account
                     * associated with a card.
                     */
                    @JvmField val BALANCE_INQUIRY = of("balance_inquiry")

                    /** The processing category is unknown. */
                    @JvmField val UNKNOWN = of("unknown")

                    @JvmStatic fun of(value: String) = ProcessingCategory(JsonField.of(value))
                }

                /** An enum containing [ProcessingCategory]'s known values. */
                enum class Known {
                    /**
                     * Account funding transactions are transactions used to e.g., fund an account
                     * or transfer funds between accounts.
                     */
                    ACCOUNT_FUNDING,
                    /**
                     * Automatic fuel dispenser authorizations occur when a card is used at a gas
                     * pump, prior to the actual transaction amount being known. They are followed
                     * by an advice message that updates the amount of the pending transaction.
                     */
                    AUTOMATIC_FUEL_DISPENSER,
                    /** A transaction used to pay a bill. */
                    BILL_PAYMENT,
                    /** Original credit transactions are used to send money to a cardholder. */
                    ORIGINAL_CREDIT,
                    /** A regular purchase. */
                    PURCHASE,
                    /**
                     * Quasi-cash transactions represent purchases of items which may be convertible
                     * to cash.
                     */
                    QUASI_CASH,
                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    REFUND,
                    /**
                     * Cash disbursement transactions are used to withdraw cash from an ATM or a
                     * point of sale.
                     */
                    CASH_DISBURSEMENT,
                    /**
                     * Cash deposit transactions are used to deposit cash at an ATM or a point of
                     * sale.
                     */
                    CASH_DEPOSIT,
                    /**
                     * A balance inquiry transaction is used to check the balance of an account
                     * associated with a card.
                     */
                    BALANCE_INQUIRY,
                    /** The processing category is unknown. */
                    UNKNOWN,
                }

                /**
                 * An enum containing [ProcessingCategory]'s known values, as well as an [_UNKNOWN]
                 * member.
                 *
                 * An instance of [ProcessingCategory] can contain an unknown value in a couple of
                 * cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /**
                     * Account funding transactions are transactions used to e.g., fund an account
                     * or transfer funds between accounts.
                     */
                    ACCOUNT_FUNDING,
                    /**
                     * Automatic fuel dispenser authorizations occur when a card is used at a gas
                     * pump, prior to the actual transaction amount being known. They are followed
                     * by an advice message that updates the amount of the pending transaction.
                     */
                    AUTOMATIC_FUEL_DISPENSER,
                    /** A transaction used to pay a bill. */
                    BILL_PAYMENT,
                    /** Original credit transactions are used to send money to a cardholder. */
                    ORIGINAL_CREDIT,
                    /** A regular purchase. */
                    PURCHASE,
                    /**
                     * Quasi-cash transactions represent purchases of items which may be convertible
                     * to cash.
                     */
                    QUASI_CASH,
                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    REFUND,
                    /**
                     * Cash disbursement transactions are used to withdraw cash from an ATM or a
                     * point of sale.
                     */
                    CASH_DISBURSEMENT,
                    /**
                     * Cash deposit transactions are used to deposit cash at an ATM or a point of
                     * sale.
                     */
                    CASH_DEPOSIT,
                    /**
                     * A balance inquiry transaction is used to check the balance of an account
                     * associated with a card.
                     */
                    BALANCE_INQUIRY,
                    /** The processing category is unknown. */
                    UNKNOWN,
                    /**
                     * An enum member indicating that [ProcessingCategory] was instantiated with an
                     * unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        ACCOUNT_FUNDING -> Value.ACCOUNT_FUNDING
                        AUTOMATIC_FUEL_DISPENSER -> Value.AUTOMATIC_FUEL_DISPENSER
                        BILL_PAYMENT -> Value.BILL_PAYMENT
                        ORIGINAL_CREDIT -> Value.ORIGINAL_CREDIT
                        PURCHASE -> Value.PURCHASE
                        QUASI_CASH -> Value.QUASI_CASH
                        REFUND -> Value.REFUND
                        CASH_DISBURSEMENT -> Value.CASH_DISBURSEMENT
                        CASH_DEPOSIT -> Value.CASH_DEPOSIT
                        BALANCE_INQUIRY -> Value.BALANCE_INQUIRY
                        UNKNOWN -> Value.UNKNOWN
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        ACCOUNT_FUNDING -> Known.ACCOUNT_FUNDING
                        AUTOMATIC_FUEL_DISPENSER -> Known.AUTOMATIC_FUEL_DISPENSER
                        BILL_PAYMENT -> Known.BILL_PAYMENT
                        ORIGINAL_CREDIT -> Known.ORIGINAL_CREDIT
                        PURCHASE -> Known.PURCHASE
                        QUASI_CASH -> Known.QUASI_CASH
                        REFUND -> Known.REFUND
                        CASH_DISBURSEMENT -> Known.CASH_DISBURSEMENT
                        CASH_DEPOSIT -> Known.CASH_DEPOSIT
                        BALANCE_INQUIRY -> Known.BALANCE_INQUIRY
                        UNKNOWN -> Known.UNKNOWN
                        else ->
                            throw IncreaseInvalidDataException("Unknown ProcessingCategory: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): ProcessingCategory = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is ProcessingCategory && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** This is present if a specific decline reason was given in the real-time decision. */
            class RealTimeDecisionReason
            @JsonCreator
            private constructor(private val value: JsonField<String>) : Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /**
                     * The cardholder does not have sufficient funds to cover the transaction. The
                     * merchant may attempt to process the transaction again.
                     */
                    @JvmField val INSUFFICIENT_FUNDS = of("insufficient_funds")

                    /**
                     * This type of transaction is not allowed for this card. This transaction
                     * should not be retried.
                     */
                    @JvmField val TRANSACTION_NEVER_ALLOWED = of("transaction_never_allowed")

                    /**
                     * The transaction amount exceeds the cardholder's approval limit. The merchant
                     * may attempt to process the transaction again.
                     */
                    @JvmField val EXCEEDS_APPROVAL_LIMIT = of("exceeds_approval_limit")

                    /**
                     * The card has been temporarily disabled or not yet activated. The merchant may
                     * attempt to process the transaction again.
                     */
                    @JvmField val CARD_TEMPORARILY_DISABLED = of("card_temporarily_disabled")

                    /**
                     * The transaction is suspected to be fraudulent. The merchant may attempt to
                     * process the transaction again.
                     */
                    @JvmField val SUSPECTED_FRAUD = of("suspected_fraud")

                    /**
                     * The transaction was declined for another reason. The merchant may attempt to
                     * process the transaction again. This should be used sparingly.
                     */
                    @JvmField val OTHER = of("other")

                    @JvmStatic fun of(value: String) = RealTimeDecisionReason(JsonField.of(value))
                }

                /** An enum containing [RealTimeDecisionReason]'s known values. */
                enum class Known {
                    /**
                     * The cardholder does not have sufficient funds to cover the transaction. The
                     * merchant may attempt to process the transaction again.
                     */
                    INSUFFICIENT_FUNDS,
                    /**
                     * This type of transaction is not allowed for this card. This transaction
                     * should not be retried.
                     */
                    TRANSACTION_NEVER_ALLOWED,
                    /**
                     * The transaction amount exceeds the cardholder's approval limit. The merchant
                     * may attempt to process the transaction again.
                     */
                    EXCEEDS_APPROVAL_LIMIT,
                    /**
                     * The card has been temporarily disabled or not yet activated. The merchant may
                     * attempt to process the transaction again.
                     */
                    CARD_TEMPORARILY_DISABLED,
                    /**
                     * The transaction is suspected to be fraudulent. The merchant may attempt to
                     * process the transaction again.
                     */
                    SUSPECTED_FRAUD,
                    /**
                     * The transaction was declined for another reason. The merchant may attempt to
                     * process the transaction again. This should be used sparingly.
                     */
                    OTHER,
                }

                /**
                 * An enum containing [RealTimeDecisionReason]'s known values, as well as an
                 * [_UNKNOWN] member.
                 *
                 * An instance of [RealTimeDecisionReason] can contain an unknown value in a couple
                 * of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /**
                     * The cardholder does not have sufficient funds to cover the transaction. The
                     * merchant may attempt to process the transaction again.
                     */
                    INSUFFICIENT_FUNDS,
                    /**
                     * This type of transaction is not allowed for this card. This transaction
                     * should not be retried.
                     */
                    TRANSACTION_NEVER_ALLOWED,
                    /**
                     * The transaction amount exceeds the cardholder's approval limit. The merchant
                     * may attempt to process the transaction again.
                     */
                    EXCEEDS_APPROVAL_LIMIT,
                    /**
                     * The card has been temporarily disabled or not yet activated. The merchant may
                     * attempt to process the transaction again.
                     */
                    CARD_TEMPORARILY_DISABLED,
                    /**
                     * The transaction is suspected to be fraudulent. The merchant may attempt to
                     * process the transaction again.
                     */
                    SUSPECTED_FRAUD,
                    /**
                     * The transaction was declined for another reason. The merchant may attempt to
                     * process the transaction again. This should be used sparingly.
                     */
                    OTHER,
                    /**
                     * An enum member indicating that [RealTimeDecisionReason] was instantiated with
                     * an unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS
                        TRANSACTION_NEVER_ALLOWED -> Value.TRANSACTION_NEVER_ALLOWED
                        EXCEEDS_APPROVAL_LIMIT -> Value.EXCEEDS_APPROVAL_LIMIT
                        CARD_TEMPORARILY_DISABLED -> Value.CARD_TEMPORARILY_DISABLED
                        SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD
                        OTHER -> Value.OTHER
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS
                        TRANSACTION_NEVER_ALLOWED -> Known.TRANSACTION_NEVER_ALLOWED
                        EXCEEDS_APPROVAL_LIMIT -> Known.EXCEEDS_APPROVAL_LIMIT
                        CARD_TEMPORARILY_DISABLED -> Known.CARD_TEMPORARILY_DISABLED
                        SUSPECTED_FRAUD -> Known.SUSPECTED_FRAUD
                        OTHER -> Known.OTHER
                        else ->
                            throw IncreaseInvalidDataException(
                                "Unknown RealTimeDecisionReason: $value"
                            )
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): RealTimeDecisionReason = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is RealTimeDecisionReason && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** Why the transaction was declined. */
            class Reason @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** The account has been closed. */
                    @JvmField val ACCOUNT_CLOSED = of("account_closed")

                    /** The Card was not active. */
                    @JvmField val CARD_NOT_ACTIVE = of("card_not_active")

                    /** The Card has been canceled. */
                    @JvmField val CARD_CANCELED = of("card_canceled")

                    /** The Physical Card was not active. */
                    @JvmField val PHYSICAL_CARD_NOT_ACTIVE = of("physical_card_not_active")

                    /** The account's entity was not active. */
                    @JvmField val ENTITY_NOT_ACTIVE = of("entity_not_active")

                    /** The account was inactive. */
                    @JvmField val GROUP_LOCKED = of("group_locked")

                    /** The Card's Account did not have a sufficient available balance. */
                    @JvmField val INSUFFICIENT_FUNDS = of("insufficient_funds")

                    /** The given CVV2 did not match the card's value. */
                    @JvmField val CVV2_MISMATCH = of("cvv2_mismatch")

                    /** The given PIN did not match the card's value. */
                    @JvmField val PIN_MISMATCH = of("pin_mismatch")

                    /**
                     * The given expiration date did not match the card's value. Only applies when a
                     * CVV2 is present.
                     */
                    @JvmField val CARD_EXPIRATION_MISMATCH = of("card_expiration_mismatch")

                    /** The attempted card transaction is not allowed per Increase's terms. */
                    @JvmField val TRANSACTION_NOT_ALLOWED = of("transaction_not_allowed")

                    /** The transaction was blocked by a limit or an authorization control. */
                    @JvmField val BREACHES_LIMIT = of("breaches_limit")

                    /** Your application declined the transaction via webhook. */
                    @JvmField val WEBHOOK_DECLINED = of("webhook_declined")

                    /** Your application webhook did not respond without the required timeout. */
                    @JvmField val WEBHOOK_TIMED_OUT = of("webhook_timed_out")

                    /** Declined by stand-in processing. */
                    @JvmField
                    val DECLINED_BY_STAND_IN_PROCESSING = of("declined_by_stand_in_processing")

                    /** The card read had an invalid CVV or dCVV. */
                    @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card")

                    /**
                     * The original card authorization for this incremental authorization does not
                     * exist.
                     */
                    @JvmField
                    val MISSING_ORIGINAL_AUTHORIZATION = of("missing_original_authorization")

                    /**
                     * The card's authorization request cryptogram was invalid. The cryptogram can
                     * be from a physical card or a Digital Wallet Token purchase.
                     */
                    @JvmField val INVALID_CRYPTOGRAM = of("invalid_cryptogram")

                    /** The transaction was declined because the 3DS authentication failed. */
                    @JvmField val FAILED_3DS_AUTHENTICATION = of("failed_3ds_authentication")

                    /**
                     * The transaction was suspected to be used by a card tester to test for valid
                     * card numbers.
                     */
                    @JvmField val SUSPECTED_CARD_TESTING = of("suspected_card_testing")

                    /**
                     * The transaction was suspected to be fraudulent. Please reach out to
                     * support@increase.com for more information.
                     */
                    @JvmField val SUSPECTED_FRAUD = of("suspected_fraud")

                    @JvmStatic fun of(value: String) = Reason(JsonField.of(value))
                }

                /** An enum containing [Reason]'s known values. */
                enum class Known {
                    /** The account has been closed. */
                    ACCOUNT_CLOSED,
                    /** The Card was not active. */
                    CARD_NOT_ACTIVE,
                    /** The Card has been canceled. */
                    CARD_CANCELED,
                    /** The Physical Card was not active. */
                    PHYSICAL_CARD_NOT_ACTIVE,
                    /** The account's entity was not active. */
                    ENTITY_NOT_ACTIVE,
                    /** The account was inactive. */
                    GROUP_LOCKED,
                    /** The Card's Account did not have a sufficient available balance. */
                    INSUFFICIENT_FUNDS,
                    /** The given CVV2 did not match the card's value. */
                    CVV2_MISMATCH,
                    /** The given PIN did not match the card's value. */
                    PIN_MISMATCH,
                    /**
                     * The given expiration date did not match the card's value. Only applies when a
                     * CVV2 is present.
                     */
                    CARD_EXPIRATION_MISMATCH,
                    /** The attempted card transaction is not allowed per Increase's terms. */
                    TRANSACTION_NOT_ALLOWED,
                    /** The transaction was blocked by a limit or an authorization control. */
                    BREACHES_LIMIT,
                    /** Your application declined the transaction via webhook. */
                    WEBHOOK_DECLINED,
                    /** Your application webhook did not respond without the required timeout. */
                    WEBHOOK_TIMED_OUT,
                    /** Declined by stand-in processing. */
                    DECLINED_BY_STAND_IN_PROCESSING,
                    /** The card read had an invalid CVV or dCVV. */
                    INVALID_PHYSICAL_CARD,
                    /**
                     * The original card authorization for this incremental authorization does not
                     * exist.
                     */
                    MISSING_ORIGINAL_AUTHORIZATION,
                    /**
                     * The card's authorization request cryptogram was invalid. The cryptogram can
                     * be from a physical card or a Digital Wallet Token purchase.
                     */
                    INVALID_CRYPTOGRAM,
                    /** The transaction was declined because the 3DS authentication failed. */
                    FAILED_3DS_AUTHENTICATION,
                    /**
                     * The transaction was suspected to be used by a card tester to test for valid
                     * card numbers.
                     */
                    SUSPECTED_CARD_TESTING,
                    /**
                     * The transaction was suspected to be fraudulent. Please reach out to
                     * support@increase.com for more information.
                     */
                    SUSPECTED_FRAUD,
                }

                /**
                 * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Reason] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** The account has been closed. */
                    ACCOUNT_CLOSED,
                    /** The Card was not active. */
                    CARD_NOT_ACTIVE,
                    /** The Card has been canceled. */
                    CARD_CANCELED,
                    /** The Physical Card was not active. */
                    PHYSICAL_CARD_NOT_ACTIVE,
                    /** The account's entity was not active. */
                    ENTITY_NOT_ACTIVE,
                    /** The account was inactive. */
                    GROUP_LOCKED,
                    /** The Card's Account did not have a sufficient available balance. */
                    INSUFFICIENT_FUNDS,
                    /** The given CVV2 did not match the card's value. */
                    CVV2_MISMATCH,
                    /** The given PIN did not match the card's value. */
                    PIN_MISMATCH,
                    /**
                     * The given expiration date did not match the card's value. Only applies when a
                     * CVV2 is present.
                     */
                    CARD_EXPIRATION_MISMATCH,
                    /** The attempted card transaction is not allowed per Increase's terms. */
                    TRANSACTION_NOT_ALLOWED,
                    /** The transaction was blocked by a limit or an authorization control. */
                    BREACHES_LIMIT,
                    /** Your application declined the transaction via webhook. */
                    WEBHOOK_DECLINED,
                    /** Your application webhook did not respond without the required timeout. */
                    WEBHOOK_TIMED_OUT,
                    /** Declined by stand-in processing. */
                    DECLINED_BY_STAND_IN_PROCESSING,
                    /** The card read had an invalid CVV or dCVV. */
                    INVALID_PHYSICAL_CARD,
                    /**
                     * The original card authorization for this incremental authorization does not
                     * exist.
                     */
                    MISSING_ORIGINAL_AUTHORIZATION,
                    /**
                     * The card's authorization request cryptogram was invalid. The cryptogram can
                     * be from a physical card or a Digital Wallet Token purchase.
                     */
                    INVALID_CRYPTOGRAM,
                    /** The transaction was declined because the 3DS authentication failed. */
                    FAILED_3DS_AUTHENTICATION,
                    /**
                     * The transaction was suspected to be used by a card tester to test for valid
                     * card numbers.
                     */
                    SUSPECTED_CARD_TESTING,
                    /**
                     * The transaction was suspected to be fraudulent. Please reach out to
                     * support@increase.com for more information.
                     */
                    SUSPECTED_FRAUD,
                    /**
                     * An enum member indicating that [Reason] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        ACCOUNT_CLOSED -> Value.ACCOUNT_CLOSED
                        CARD_NOT_ACTIVE -> Value.CARD_NOT_ACTIVE
                        CARD_CANCELED -> Value.CARD_CANCELED
                        PHYSICAL_CARD_NOT_ACTIVE -> Value.PHYSICAL_CARD_NOT_ACTIVE
                        ENTITY_NOT_ACTIVE -> Value.ENTITY_NOT_ACTIVE
                        GROUP_LOCKED -> Value.GROUP_LOCKED
                        INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS
                        CVV2_MISMATCH -> Value.CVV2_MISMATCH
                        PIN_MISMATCH -> Value.PIN_MISMATCH
                        CARD_EXPIRATION_MISMATCH -> Value.CARD_EXPIRATION_MISMATCH
                        TRANSACTION_NOT_ALLOWED -> Value.TRANSACTION_NOT_ALLOWED
                        BREACHES_LIMIT -> Value.BREACHES_LIMIT
                        WEBHOOK_DECLINED -> Value.WEBHOOK_DECLINED
                        WEBHOOK_TIMED_OUT -> Value.WEBHOOK_TIMED_OUT
                        DECLINED_BY_STAND_IN_PROCESSING -> Value.DECLINED_BY_STAND_IN_PROCESSING
                        INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD
                        MISSING_ORIGINAL_AUTHORIZATION -> Value.MISSING_ORIGINAL_AUTHORIZATION
                        INVALID_CRYPTOGRAM -> Value.INVALID_CRYPTOGRAM
                        FAILED_3DS_AUTHENTICATION -> Value.FAILED_3DS_AUTHENTICATION
                        SUSPECTED_CARD_TESTING -> Value.SUSPECTED_CARD_TESTING
                        SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        ACCOUNT_CLOSED -> Known.ACCOUNT_CLOSED
                        CARD_NOT_ACTIVE -> Known.CARD_NOT_ACTIVE
                        CARD_CANCELED -> Known.CARD_CANCELED
                        PHYSICAL_CARD_NOT_ACTIVE -> Known.PHYSICAL_CARD_NOT_ACTIVE
                        ENTITY_NOT_ACTIVE -> Known.ENTITY_NOT_ACTIVE
                        GROUP_LOCKED -> Known.GROUP_LOCKED
                        INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS
                        CVV2_MISMATCH -> Known.CVV2_MISMATCH
                        PIN_MISMATCH -> Known.PIN_MISMATCH
                        CARD_EXPIRATION_MISMATCH -> Known.CARD_EXPIRATION_MISMATCH
                        TRANSACTION_NOT_ALLOWED -> Known.TRANSACTION_NOT_ALLOWED
                        BREACHES_LIMIT -> Known.BREACHES_LIMIT
                        WEBHOOK_DECLINED -> Known.WEBHOOK_DECLINED
                        WEBHOOK_TIMED_OUT -> Known.WEBHOOK_TIMED_OUT
                        DECLINED_BY_STAND_IN_PROCESSING -> Known.DECLINED_BY_STAND_IN_PROCESSING
                        INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD
                        MISSING_ORIGINAL_AUTHORIZATION -> Known.MISSING_ORIGINAL_AUTHORIZATION
                        INVALID_CRYPTOGRAM -> Known.INVALID_CRYPTOGRAM
                        FAILED_3DS_AUTHENTICATION -> Known.FAILED_3DS_AUTHENTICATION
                        SUSPECTED_CARD_TESTING -> Known.SUSPECTED_CARD_TESTING
                        SUSPECTED_FRAUD -> Known.SUSPECTED_FRAUD
                        else -> throw IncreaseInvalidDataException("Unknown Reason: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Reason = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Reason && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            class SchemeFee
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val amount: JsonField<String>,
                private val createdAt: JsonField<OffsetDateTime>,
                private val currency: JsonField<Currency>,
                private val feeType: JsonField<FeeType>,
                private val fixedComponent: JsonField<String>,
                private val variableRate: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("amount")
                    @ExcludeMissing
                    amount: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("created_at")
                    @ExcludeMissing
                    createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                    @JsonProperty("currency")
                    @ExcludeMissing
                    currency: JsonField<Currency> = JsonMissing.of(),
                    @JsonProperty("fee_type")
                    @ExcludeMissing
                    feeType: JsonField<FeeType> = JsonMissing.of(),
                    @JsonProperty("fixed_component")
                    @ExcludeMissing
                    fixedComponent: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("variable_rate")
                    @ExcludeMissing
                    variableRate: JsonField<String> = JsonMissing.of(),
                ) : this(
                    amount,
                    createdAt,
                    currency,
                    feeType,
                    fixedComponent,
                    variableRate,
                    mutableMapOf(),
                )

                /**
                 * The fee amount given as a string containing a decimal number.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun amount(): String = amount.getRequired("amount")

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was
                 * created.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /**
                 * The type of fee being assessed.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun feeType(): FeeType = feeType.getRequired("fee_type")

                /**
                 * The fixed component of the fee, if applicable, given in major units of the fee
                 * amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun fixedComponent(): Optional<String> =
                    fixedComponent.getOptional("fixed_component")

                /**
                 * The variable rate component of the fee, if applicable, given as a decimal (e.g.,
                 * 0.015 for 1.5%).
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun variableRate(): Optional<String> = variableRate.getOptional("variable_rate")

                /**
                 * Returns the raw JSON value of [amount].
                 *
                 * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<String> = amount

                /**
                 * Returns the raw JSON value of [createdAt].
                 *
                 * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("created_at")
                @ExcludeMissing
                fun _createdAt(): JsonField<OffsetDateTime> = createdAt

                /**
                 * Returns the raw JSON value of [currency].
                 *
                 * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun _currency(): JsonField<Currency> = currency

                /**
                 * Returns the raw JSON value of [feeType].
                 *
                 * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("fee_type")
                @ExcludeMissing
                fun _feeType(): JsonField<FeeType> = feeType

                /**
                 * Returns the raw JSON value of [fixedComponent].
                 *
                 * Unlike [fixedComponent], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("fixed_component")
                @ExcludeMissing
                fun _fixedComponent(): JsonField<String> = fixedComponent

                /**
                 * Returns the raw JSON value of [variableRate].
                 *
                 * Unlike [variableRate], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("variable_rate")
                @ExcludeMissing
                fun _variableRate(): JsonField<String> = variableRate

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [SchemeFee].
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [SchemeFee]. */
                class Builder internal constructor() {

                    private var amount: JsonField<String>? = null
                    private var createdAt: JsonField<OffsetDateTime>? = null
                    private var currency: JsonField<Currency>? = null
                    private var feeType: JsonField<FeeType>? = null
                    private var fixedComponent: JsonField<String>? = null
                    private var variableRate: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(schemeFee: SchemeFee) = apply {
                        amount = schemeFee.amount
                        createdAt = schemeFee.createdAt
                        currency = schemeFee.currency
                        feeType = schemeFee.feeType
                        fixedComponent = schemeFee.fixedComponent
                        variableRate = schemeFee.variableRate
                        additionalProperties = schemeFee.additionalProperties.toMutableMap()
                    }

                    /** The fee amount given as a string containing a decimal number. */
                    fun amount(amount: String) = amount(JsonField.of(amount))

                    /**
                     * Sets [Builder.amount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.amount] with a well-typed [String] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun amount(amount: JsonField<String>) = apply { this.amount = amount }

                    /**
                     * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee
                     * was created.
                     */
                    fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt))

                    /**
                     * Sets [Builder.createdAt] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.createdAt] with a well-typed
                     * [OffsetDateTime] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply {
                        this.createdAt = createdAt
                    }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                     * reimbursement.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * Sets [Builder.currency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.currency] with a well-typed [Currency] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                    /** The type of fee being assessed. */
                    fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType))

                    /**
                     * Sets [Builder.feeType] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.feeType] with a well-typed [FeeType] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun feeType(feeType: JsonField<FeeType>) = apply { this.feeType = feeType }

                    /**
                     * The fixed component of the fee, if applicable, given in major units of the
                     * fee amount.
                     */
                    fun fixedComponent(fixedComponent: String?) =
                        fixedComponent(JsonField.ofNullable(fixedComponent))

                    /**
                     * Alias for calling [Builder.fixedComponent] with
                     * `fixedComponent.orElse(null)`.
                     */
                    fun fixedComponent(fixedComponent: Optional<String>) =
                        fixedComponent(fixedComponent.getOrNull())

                    /**
                     * Sets [Builder.fixedComponent] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.fixedComponent] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun fixedComponent(fixedComponent: JsonField<String>) = apply {
                        this.fixedComponent = fixedComponent
                    }

                    /**
                     * The variable rate component of the fee, if applicable, given as a decimal
                     * (e.g., 0.015 for 1.5%).
                     */
                    fun variableRate(variableRate: String?) =
                        variableRate(JsonField.ofNullable(variableRate))

                    /**
                     * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`.
                     */
                    fun variableRate(variableRate: Optional<String>) =
                        variableRate(variableRate.getOrNull())

                    /**
                     * Sets [Builder.variableRate] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.variableRate] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun variableRate(variableRate: JsonField<String>) = apply {
                        this.variableRate = variableRate
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [SchemeFee].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): SchemeFee =
                        SchemeFee(
                            checkRequired("amount", amount),
                            checkRequired("createdAt", createdAt),
                            checkRequired("currency", currency),
                            checkRequired("feeType", feeType),
                            checkRequired("fixedComponent", fixedComponent),
                            checkRequired("variableRate", variableRate),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): SchemeFee = apply {
                    if (validated) {
                        return@apply
                    }

                    amount()
                    createdAt()
                    currency().validate()
                    feeType().validate()
                    fixedComponent()
                    variableRate()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (amount.asKnown().isPresent) 1 else 0) +
                        (if (createdAt.asKnown().isPresent) 1 else 0) +
                        (currency.asKnown().getOrNull()?.validity() ?: 0) +
                        (feeType.asKnown().getOrNull()?.validity() ?: 0) +
                        (if (fixedComponent.asKnown().isPresent) 1 else 0) +
                        (if (variableRate.asKnown().isPresent) 1 else 0)

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 */
                class Currency
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** US Dollar (USD) */
                        @JvmField val USD = of("USD")

                        @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                    }

                    /** An enum containing [Currency]'s known values. */
                    enum class Known {
                        /** US Dollar (USD) */
                        USD
                    }

                    /**
                     * An enum containing [Currency]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Currency] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** US Dollar (USD) */
                        USD,
                        /**
                         * An enum member indicating that [Currency] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            USD -> Value.USD
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            USD -> Known.USD
                            else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Currency = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Currency && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** The type of fee being assessed. */
                class FeeType
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY =
                            of("visa_international_service_assessment_single_currency")

                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY =
                            of("visa_international_service_assessment_cross_currency")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE =
                            of("visa_authorization_domestic_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_international_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE =
                            of("visa_authorization_canada_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_international_point_of_sale")

                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE =
                            of("visa_authorization_address_verification_service")

                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        @JvmField
                        val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization")

                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission")

                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_DOMESTIC =
                            of("visa_account_verification_domestic")

                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL =
                            of("visa_account_verification_international")

                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_CANADA =
                            of("visa_account_verification_canada")

                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee")

                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        @JvmField
                        val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE =
                            of("visa_consumer_debit_acceptance_fee")

                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        @JvmField
                        val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE =
                            of("visa_business_debit_acceptance_fee")

                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee")

                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic")

                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        @JvmField
                        val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international")

                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token")

                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token")

                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission")

                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization")

                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        @JvmField
                        val VISA_DIRECT_TRANSACTION_DOMESTIC =
                            of("visa_direct_transaction_domestic")

                        /** Issuer card service fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit")

                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT =
                            of("visa_advertising_service_commercial_credit")

                        /** Issuer Community Growth Acceleration Program Fee. */
                        @JvmField
                        val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM =
                            of("visa_community_growth_acceleration_program")

                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        @JvmField
                        val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT =
                            of("visa_processing_guarantee_commercial_credit")

                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee")

                        @JvmStatic fun of(value: String) = FeeType(JsonField.of(value))
                    }

                    /** An enum containing [FeeType]'s known values. */
                    enum class Known {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                    }

                    /**
                     * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member.
                     *
                     * An instance of [FeeType] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                        /**
                         * An enum member indicating that [FeeType] was instantiated with an unknown
                         * value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Value.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Value.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Known.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Known.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE
                            else -> throw IncreaseInvalidDataException("Unknown FeeType: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): FeeType = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is FeeType && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is SchemeFee &&
                        amount == other.amount &&
                        createdAt == other.createdAt &&
                        currency == other.currency &&
                        feeType == other.feeType &&
                        fixedComponent == other.fixedComponent &&
                        variableRate == other.variableRate &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        amount,
                        createdAt,
                        currency,
                        feeType,
                        fixedComponent,
                        variableRate,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}"
            }

            /** Fields related to verification of cardholder-provided values. */
            class Verification
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val cardVerificationCode: JsonField<CardVerificationCode>,
                private val cardholderAddress: JsonField<CardholderAddress>,
                private val cardholderName: JsonField<CardholderName>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("card_verification_code")
                    @ExcludeMissing
                    cardVerificationCode: JsonField<CardVerificationCode> = JsonMissing.of(),
                    @JsonProperty("cardholder_address")
                    @ExcludeMissing
                    cardholderAddress: JsonField<CardholderAddress> = JsonMissing.of(),
                    @JsonProperty("cardholder_name")
                    @ExcludeMissing
                    cardholderName: JsonField<CardholderName> = JsonMissing.of(),
                ) : this(cardVerificationCode, cardholderAddress, cardholderName, mutableMapOf())

                /**
                 * Fields related to verification of the Card Verification Code, a 3-digit code on
                 * the back of the card.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun cardVerificationCode(): CardVerificationCode =
                    cardVerificationCode.getRequired("card_verification_code")

                /**
                 * Cardholder address provided in the authorization request and the address on file
                 * we verified it against.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun cardholderAddress(): CardholderAddress =
                    cardholderAddress.getRequired("cardholder_address")

                /**
                 * Cardholder name provided in the authorization request.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun cardholderName(): Optional<CardholderName> =
                    cardholderName.getOptional("cardholder_name")

                /**
                 * Returns the raw JSON value of [cardVerificationCode].
                 *
                 * Unlike [cardVerificationCode], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("card_verification_code")
                @ExcludeMissing
                fun _cardVerificationCode(): JsonField<CardVerificationCode> = cardVerificationCode

                /**
                 * Returns the raw JSON value of [cardholderAddress].
                 *
                 * Unlike [cardholderAddress], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("cardholder_address")
                @ExcludeMissing
                fun _cardholderAddress(): JsonField<CardholderAddress> = cardholderAddress

                /**
                 * Returns the raw JSON value of [cardholderName].
                 *
                 * Unlike [cardholderName], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("cardholder_name")
                @ExcludeMissing
                fun _cardholderName(): JsonField<CardholderName> = cardholderName

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [Verification].
                     *
                     * The following fields are required:
                     * ```java
                     * .cardVerificationCode()
                     * .cardholderAddress()
                     * .cardholderName()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [Verification]. */
                class Builder internal constructor() {

                    private var cardVerificationCode: JsonField<CardVerificationCode>? = null
                    private var cardholderAddress: JsonField<CardholderAddress>? = null
                    private var cardholderName: JsonField<CardholderName>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(verification: Verification) = apply {
                        cardVerificationCode = verification.cardVerificationCode
                        cardholderAddress = verification.cardholderAddress
                        cardholderName = verification.cardholderName
                        additionalProperties = verification.additionalProperties.toMutableMap()
                    }

                    /**
                     * Fields related to verification of the Card Verification Code, a 3-digit code
                     * on the back of the card.
                     */
                    fun cardVerificationCode(cardVerificationCode: CardVerificationCode) =
                        cardVerificationCode(JsonField.of(cardVerificationCode))

                    /**
                     * Sets [Builder.cardVerificationCode] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.cardVerificationCode] with a well-typed
                     * [CardVerificationCode] value instead. This method is primarily for setting
                     * the field to an undocumented or not yet supported value.
                     */
                    fun cardVerificationCode(
                        cardVerificationCode: JsonField<CardVerificationCode>
                    ) = apply { this.cardVerificationCode = cardVerificationCode }

                    /**
                     * Cardholder address provided in the authorization request and the address on
                     * file we verified it against.
                     */
                    fun cardholderAddress(cardholderAddress: CardholderAddress) =
                        cardholderAddress(JsonField.of(cardholderAddress))

                    /**
                     * Sets [Builder.cardholderAddress] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.cardholderAddress] with a well-typed
                     * [CardholderAddress] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun cardholderAddress(cardholderAddress: JsonField<CardholderAddress>) = apply {
                        this.cardholderAddress = cardholderAddress
                    }

                    /** Cardholder name provided in the authorization request. */
                    fun cardholderName(cardholderName: CardholderName?) =
                        cardholderName(JsonField.ofNullable(cardholderName))

                    /**
                     * Alias for calling [Builder.cardholderName] with
                     * `cardholderName.orElse(null)`.
                     */
                    fun cardholderName(cardholderName: Optional<CardholderName>) =
                        cardholderName(cardholderName.getOrNull())

                    /**
                     * Sets [Builder.cardholderName] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.cardholderName] with a well-typed
                     * [CardholderName] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun cardholderName(cardholderName: JsonField<CardholderName>) = apply {
                        this.cardholderName = cardholderName
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [Verification].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .cardVerificationCode()
                     * .cardholderAddress()
                     * .cardholderName()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): Verification =
                        Verification(
                            checkRequired("cardVerificationCode", cardVerificationCode),
                            checkRequired("cardholderAddress", cardholderAddress),
                            checkRequired("cardholderName", cardholderName),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Verification = apply {
                    if (validated) {
                        return@apply
                    }

                    cardVerificationCode().validate()
                    cardholderAddress().validate()
                    cardholderName().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (cardVerificationCode.asKnown().getOrNull()?.validity() ?: 0) +
                        (cardholderAddress.asKnown().getOrNull()?.validity() ?: 0) +
                        (cardholderName.asKnown().getOrNull()?.validity() ?: 0)

                /**
                 * Fields related to verification of the Card Verification Code, a 3-digit code on
                 * the back of the card.
                 */
                class CardVerificationCode
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val result: JsonField<Result>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("result")
                        @ExcludeMissing
                        result: JsonField<Result> = JsonMissing.of()
                    ) : this(result, mutableMapOf())

                    /**
                     * The result of verifying the Card Verification Code.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun result(): Result = result.getRequired("result")

                    /**
                     * Returns the raw JSON value of [result].
                     *
                     * Unlike [result], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("result")
                    @ExcludeMissing
                    fun _result(): JsonField<Result> = result

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [CardVerificationCode].
                         *
                         * The following fields are required:
                         * ```java
                         * .result()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CardVerificationCode]. */
                    class Builder internal constructor() {

                        private var result: JsonField<Result>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(cardVerificationCode: CardVerificationCode) = apply {
                            result = cardVerificationCode.result
                            additionalProperties =
                                cardVerificationCode.additionalProperties.toMutableMap()
                        }

                        /** The result of verifying the Card Verification Code. */
                        fun result(result: Result) = result(JsonField.of(result))

                        /**
                         * Sets [Builder.result] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.result] with a well-typed [Result] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun result(result: JsonField<Result>) = apply { this.result = result }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CardVerificationCode].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .result()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CardVerificationCode =
                            CardVerificationCode(
                                checkRequired("result", result),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CardVerificationCode = apply {
                        if (validated) {
                            return@apply
                        }

                        result().validate()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0)

                    /** The result of verifying the Card Verification Code. */
                    class Result
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /**
                             * No card verification code was provided in the authorization request.
                             */
                            @JvmField val NOT_CHECKED = of("not_checked")

                            /** The card verification code matched the one on file. */
                            @JvmField val MATCH = of("match")

                            /** The card verification code did not match the one on file. */
                            @JvmField val NO_MATCH = of("no_match")

                            @JvmStatic fun of(value: String) = Result(JsonField.of(value))
                        }

                        /** An enum containing [Result]'s known values. */
                        enum class Known {
                            /**
                             * No card verification code was provided in the authorization request.
                             */
                            NOT_CHECKED,
                            /** The card verification code matched the one on file. */
                            MATCH,
                            /** The card verification code did not match the one on file. */
                            NO_MATCH,
                        }

                        /**
                         * An enum containing [Result]'s known values, as well as an [_UNKNOWN]
                         * member.
                         *
                         * An instance of [Result] can contain an unknown value in a couple of
                         * cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /**
                             * No card verification code was provided in the authorization request.
                             */
                            NOT_CHECKED,
                            /** The card verification code matched the one on file. */
                            MATCH,
                            /** The card verification code did not match the one on file. */
                            NO_MATCH,
                            /**
                             * An enum member indicating that [Result] was instantiated with an
                             * unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NOT_CHECKED -> Value.NOT_CHECKED
                                MATCH -> Value.MATCH
                                NO_MATCH -> Value.NO_MATCH
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NOT_CHECKED -> Known.NOT_CHECKED
                                MATCH -> Known.MATCH
                                NO_MATCH -> Known.NO_MATCH
                                else -> throw IncreaseInvalidDataException("Unknown Result: $value")
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): Result = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is Result && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CardVerificationCode &&
                            result == other.result &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}"
                }

                /**
                 * Cardholder address provided in the authorization request and the address on file
                 * we verified it against.
                 */
                class CardholderAddress
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val actualLine1: JsonField<String>,
                    private val actualPostalCode: JsonField<String>,
                    private val providedLine1: JsonField<String>,
                    private val providedPostalCode: JsonField<String>,
                    private val result: JsonField<Result>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("actual_line1")
                        @ExcludeMissing
                        actualLine1: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("actual_postal_code")
                        @ExcludeMissing
                        actualPostalCode: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_line1")
                        @ExcludeMissing
                        providedLine1: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_postal_code")
                        @ExcludeMissing
                        providedPostalCode: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("result")
                        @ExcludeMissing
                        result: JsonField<Result> = JsonMissing.of(),
                    ) : this(
                        actualLine1,
                        actualPostalCode,
                        providedLine1,
                        providedPostalCode,
                        result,
                        mutableMapOf(),
                    )

                    /**
                     * Line 1 of the address on file for the cardholder.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun actualLine1(): Optional<String> = actualLine1.getOptional("actual_line1")

                    /**
                     * The postal code of the address on file for the cardholder.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun actualPostalCode(): Optional<String> =
                        actualPostalCode.getOptional("actual_postal_code")

                    /**
                     * The cardholder address line 1 provided for verification in the authorization
                     * request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedLine1(): Optional<String> =
                        providedLine1.getOptional("provided_line1")

                    /**
                     * The postal code provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedPostalCode(): Optional<String> =
                        providedPostalCode.getOptional("provided_postal_code")

                    /**
                     * The address verification result returned to the card network.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun result(): Result = result.getRequired("result")

                    /**
                     * Returns the raw JSON value of [actualLine1].
                     *
                     * Unlike [actualLine1], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("actual_line1")
                    @ExcludeMissing
                    fun _actualLine1(): JsonField<String> = actualLine1

                    /**
                     * Returns the raw JSON value of [actualPostalCode].
                     *
                     * Unlike [actualPostalCode], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("actual_postal_code")
                    @ExcludeMissing
                    fun _actualPostalCode(): JsonField<String> = actualPostalCode

                    /**
                     * Returns the raw JSON value of [providedLine1].
                     *
                     * Unlike [providedLine1], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("provided_line1")
                    @ExcludeMissing
                    fun _providedLine1(): JsonField<String> = providedLine1

                    /**
                     * Returns the raw JSON value of [providedPostalCode].
                     *
                     * Unlike [providedPostalCode], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("provided_postal_code")
                    @ExcludeMissing
                    fun _providedPostalCode(): JsonField<String> = providedPostalCode

                    /**
                     * Returns the raw JSON value of [result].
                     *
                     * Unlike [result], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("result")
                    @ExcludeMissing
                    fun _result(): JsonField<Result> = result

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [CardholderAddress].
                         *
                         * The following fields are required:
                         * ```java
                         * .actualLine1()
                         * .actualPostalCode()
                         * .providedLine1()
                         * .providedPostalCode()
                         * .result()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CardholderAddress]. */
                    class Builder internal constructor() {

                        private var actualLine1: JsonField<String>? = null
                        private var actualPostalCode: JsonField<String>? = null
                        private var providedLine1: JsonField<String>? = null
                        private var providedPostalCode: JsonField<String>? = null
                        private var result: JsonField<Result>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(cardholderAddress: CardholderAddress) = apply {
                            actualLine1 = cardholderAddress.actualLine1
                            actualPostalCode = cardholderAddress.actualPostalCode
                            providedLine1 = cardholderAddress.providedLine1
                            providedPostalCode = cardholderAddress.providedPostalCode
                            result = cardholderAddress.result
                            additionalProperties =
                                cardholderAddress.additionalProperties.toMutableMap()
                        }

                        /** Line 1 of the address on file for the cardholder. */
                        fun actualLine1(actualLine1: String?) =
                            actualLine1(JsonField.ofNullable(actualLine1))

                        /**
                         * Alias for calling [Builder.actualLine1] with `actualLine1.orElse(null)`.
                         */
                        fun actualLine1(actualLine1: Optional<String>) =
                            actualLine1(actualLine1.getOrNull())

                        /**
                         * Sets [Builder.actualLine1] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.actualLine1] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun actualLine1(actualLine1: JsonField<String>) = apply {
                            this.actualLine1 = actualLine1
                        }

                        /** The postal code of the address on file for the cardholder. */
                        fun actualPostalCode(actualPostalCode: String?) =
                            actualPostalCode(JsonField.ofNullable(actualPostalCode))

                        /**
                         * Alias for calling [Builder.actualPostalCode] with
                         * `actualPostalCode.orElse(null)`.
                         */
                        fun actualPostalCode(actualPostalCode: Optional<String>) =
                            actualPostalCode(actualPostalCode.getOrNull())

                        /**
                         * Sets [Builder.actualPostalCode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.actualPostalCode] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun actualPostalCode(actualPostalCode: JsonField<String>) = apply {
                            this.actualPostalCode = actualPostalCode
                        }

                        /**
                         * The cardholder address line 1 provided for verification in the
                         * authorization request.
                         */
                        fun providedLine1(providedLine1: String?) =
                            providedLine1(JsonField.ofNullable(providedLine1))

                        /**
                         * Alias for calling [Builder.providedLine1] with
                         * `providedLine1.orElse(null)`.
                         */
                        fun providedLine1(providedLine1: Optional<String>) =
                            providedLine1(providedLine1.getOrNull())

                        /**
                         * Sets [Builder.providedLine1] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedLine1] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedLine1(providedLine1: JsonField<String>) = apply {
                            this.providedLine1 = providedLine1
                        }

                        /**
                         * The postal code provided for verification in the authorization request.
                         */
                        fun providedPostalCode(providedPostalCode: String?) =
                            providedPostalCode(JsonField.ofNullable(providedPostalCode))

                        /**
                         * Alias for calling [Builder.providedPostalCode] with
                         * `providedPostalCode.orElse(null)`.
                         */
                        fun providedPostalCode(providedPostalCode: Optional<String>) =
                            providedPostalCode(providedPostalCode.getOrNull())

                        /**
                         * Sets [Builder.providedPostalCode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedPostalCode] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedPostalCode(providedPostalCode: JsonField<String>) = apply {
                            this.providedPostalCode = providedPostalCode
                        }

                        /** The address verification result returned to the card network. */
                        fun result(result: Result) = result(JsonField.of(result))

                        /**
                         * Sets [Builder.result] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.result] with a well-typed [Result] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun result(result: JsonField<Result>) = apply { this.result = result }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CardholderAddress].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .actualLine1()
                         * .actualPostalCode()
                         * .providedLine1()
                         * .providedPostalCode()
                         * .result()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CardholderAddress =
                            CardholderAddress(
                                checkRequired("actualLine1", actualLine1),
                                checkRequired("actualPostalCode", actualPostalCode),
                                checkRequired("providedLine1", providedLine1),
                                checkRequired("providedPostalCode", providedPostalCode),
                                checkRequired("result", result),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CardholderAddress = apply {
                        if (validated) {
                            return@apply
                        }

                        actualLine1()
                        actualPostalCode()
                        providedLine1()
                        providedPostalCode()
                        result().validate()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (actualLine1.asKnown().isPresent) 1 else 0) +
                            (if (actualPostalCode.asKnown().isPresent) 1 else 0) +
                            (if (providedLine1.asKnown().isPresent) 1 else 0) +
                            (if (providedPostalCode.asKnown().isPresent) 1 else 0) +
                            (result.asKnown().getOrNull()?.validity() ?: 0)

                    /** The address verification result returned to the card network. */
                    class Result
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** No address information was provided in the authorization request. */
                            @JvmField val NOT_CHECKED = of("not_checked")

                            /**
                             * Postal code matches, but the street address does not match or was not
                             * provided.
                             */
                            @JvmField
                            val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH =
                                of("postal_code_match_address_no_match")

                            /**
                             * Postal code does not match, but the street address matches or was not
                             * provided.
                             */
                            @JvmField
                            val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH =
                                of("postal_code_no_match_address_match")

                            /** Postal code and street address match. */
                            @JvmField val MATCH = of("match")

                            /** Postal code and street address do not match. */
                            @JvmField val NO_MATCH = of("no_match")

                            /**
                             * Postal code matches, but the street address was not verified.
                             * (deprecated)
                             */
                            @JvmField
                            val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED =
                                of("postal_code_match_address_not_checked")

                            @JvmStatic fun of(value: String) = Result(JsonField.of(value))
                        }

                        /** An enum containing [Result]'s known values. */
                        enum class Known {
                            /** No address information was provided in the authorization request. */
                            NOT_CHECKED,
                            /**
                             * Postal code matches, but the street address does not match or was not
                             * provided.
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NO_MATCH,
                            /**
                             * Postal code does not match, but the street address matches or was not
                             * provided.
                             */
                            POSTAL_CODE_NO_MATCH_ADDRESS_MATCH,
                            /** Postal code and street address match. */
                            MATCH,
                            /** Postal code and street address do not match. */
                            NO_MATCH,
                            /**
                             * Postal code matches, but the street address was not verified.
                             * (deprecated)
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED,
                        }

                        /**
                         * An enum containing [Result]'s known values, as well as an [_UNKNOWN]
                         * member.
                         *
                         * An instance of [Result] can contain an unknown value in a couple of
                         * cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** No address information was provided in the authorization request. */
                            NOT_CHECKED,
                            /**
                             * Postal code matches, but the street address does not match or was not
                             * provided.
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NO_MATCH,
                            /**
                             * Postal code does not match, but the street address matches or was not
                             * provided.
                             */
                            POSTAL_CODE_NO_MATCH_ADDRESS_MATCH,
                            /** Postal code and street address match. */
                            MATCH,
                            /** Postal code and street address do not match. */
                            NO_MATCH,
                            /**
                             * Postal code matches, but the street address was not verified.
                             * (deprecated)
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED,
                            /**
                             * An enum member indicating that [Result] was instantiated with an
                             * unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NOT_CHECKED -> Value.NOT_CHECKED
                                POSTAL_CODE_MATCH_ADDRESS_NO_MATCH ->
                                    Value.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH
                                POSTAL_CODE_NO_MATCH_ADDRESS_MATCH ->
                                    Value.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH
                                MATCH -> Value.MATCH
                                NO_MATCH -> Value.NO_MATCH
                                POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED ->
                                    Value.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NOT_CHECKED -> Known.NOT_CHECKED
                                POSTAL_CODE_MATCH_ADDRESS_NO_MATCH ->
                                    Known.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH
                                POSTAL_CODE_NO_MATCH_ADDRESS_MATCH ->
                                    Known.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH
                                MATCH -> Known.MATCH
                                NO_MATCH -> Known.NO_MATCH
                                POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED ->
                                    Known.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED
                                else -> throw IncreaseInvalidDataException("Unknown Result: $value")
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): Result = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is Result && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CardholderAddress &&
                            actualLine1 == other.actualLine1 &&
                            actualPostalCode == other.actualPostalCode &&
                            providedLine1 == other.providedLine1 &&
                            providedPostalCode == other.providedPostalCode &&
                            result == other.result &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            actualLine1,
                            actualPostalCode,
                            providedLine1,
                            providedPostalCode,
                            result,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}"
                }

                /** Cardholder name provided in the authorization request. */
                class CardholderName
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val providedFirstName: JsonField<String>,
                    private val providedLastName: JsonField<String>,
                    private val providedMiddleName: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("provided_first_name")
                        @ExcludeMissing
                        providedFirstName: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_last_name")
                        @ExcludeMissing
                        providedLastName: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_middle_name")
                        @ExcludeMissing
                        providedMiddleName: JsonField<String> = JsonMissing.of(),
                    ) : this(
                        providedFirstName,
                        providedLastName,
                        providedMiddleName,
                        mutableMapOf(),
                    )

                    /**
                     * The first name provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedFirstName(): Optional<String> =
                        providedFirstName.getOptional("provided_first_name")

                    /**
                     * The last name provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedLastName(): Optional<String> =
                        providedLastName.getOptional("provided_last_name")

                    /**
                     * The middle name provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedMiddleName(): Optional<String> =
                        providedMiddleName.getOptional("provided_middle_name")

                    /**
                     * Returns the raw JSON value of [providedFirstName].
                     *
                     * Unlike [providedFirstName], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("provided_first_name")
                    @ExcludeMissing
                    fun _providedFirstName(): JsonField<String> = providedFirstName

                    /**
                     * Returns the raw JSON value of [providedLastName].
                     *
                     * Unlike [providedLastName], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("provided_last_name")
                    @ExcludeMissing
                    fun _providedLastName(): JsonField<String> = providedLastName

                    /**
                     * Returns the raw JSON value of [providedMiddleName].
                     *
                     * Unlike [providedMiddleName], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("provided_middle_name")
                    @ExcludeMissing
                    fun _providedMiddleName(): JsonField<String> = providedMiddleName

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [CardholderName].
                         *
                         * The following fields are required:
                         * ```java
                         * .providedFirstName()
                         * .providedLastName()
                         * .providedMiddleName()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CardholderName]. */
                    class Builder internal constructor() {

                        private var providedFirstName: JsonField<String>? = null
                        private var providedLastName: JsonField<String>? = null
                        private var providedMiddleName: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(cardholderName: CardholderName) = apply {
                            providedFirstName = cardholderName.providedFirstName
                            providedLastName = cardholderName.providedLastName
                            providedMiddleName = cardholderName.providedMiddleName
                            additionalProperties =
                                cardholderName.additionalProperties.toMutableMap()
                        }

                        /**
                         * The first name provided for verification in the authorization request.
                         */
                        fun providedFirstName(providedFirstName: String?) =
                            providedFirstName(JsonField.ofNullable(providedFirstName))

                        /**
                         * Alias for calling [Builder.providedFirstName] with
                         * `providedFirstName.orElse(null)`.
                         */
                        fun providedFirstName(providedFirstName: Optional<String>) =
                            providedFirstName(providedFirstName.getOrNull())

                        /**
                         * Sets [Builder.providedFirstName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedFirstName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedFirstName(providedFirstName: JsonField<String>) = apply {
                            this.providedFirstName = providedFirstName
                        }

                        /** The last name provided for verification in the authorization request. */
                        fun providedLastName(providedLastName: String?) =
                            providedLastName(JsonField.ofNullable(providedLastName))

                        /**
                         * Alias for calling [Builder.providedLastName] with
                         * `providedLastName.orElse(null)`.
                         */
                        fun providedLastName(providedLastName: Optional<String>) =
                            providedLastName(providedLastName.getOrNull())

                        /**
                         * Sets [Builder.providedLastName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedLastName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedLastName(providedLastName: JsonField<String>) = apply {
                            this.providedLastName = providedLastName
                        }

                        /**
                         * The middle name provided for verification in the authorization request.
                         */
                        fun providedMiddleName(providedMiddleName: String?) =
                            providedMiddleName(JsonField.ofNullable(providedMiddleName))

                        /**
                         * Alias for calling [Builder.providedMiddleName] with
                         * `providedMiddleName.orElse(null)`.
                         */
                        fun providedMiddleName(providedMiddleName: Optional<String>) =
                            providedMiddleName(providedMiddleName.getOrNull())

                        /**
                         * Sets [Builder.providedMiddleName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedMiddleName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedMiddleName(providedMiddleName: JsonField<String>) = apply {
                            this.providedMiddleName = providedMiddleName
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CardholderName].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .providedFirstName()
                         * .providedLastName()
                         * .providedMiddleName()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CardholderName =
                            CardholderName(
                                checkRequired("providedFirstName", providedFirstName),
                                checkRequired("providedLastName", providedLastName),
                                checkRequired("providedMiddleName", providedMiddleName),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CardholderName = apply {
                        if (validated) {
                            return@apply
                        }

                        providedFirstName()
                        providedLastName()
                        providedMiddleName()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (providedFirstName.asKnown().isPresent) 1 else 0) +
                            (if (providedLastName.asKnown().isPresent) 1 else 0) +
                            (if (providedMiddleName.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CardholderName &&
                            providedFirstName == other.providedFirstName &&
                            providedLastName == other.providedLastName &&
                            providedMiddleName == other.providedMiddleName &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            providedFirstName,
                            providedLastName,
                            providedMiddleName,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CardholderName{providedFirstName=$providedFirstName, providedLastName=$providedLastName, providedMiddleName=$providedMiddleName, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Verification &&
                        cardVerificationCode == other.cardVerificationCode &&
                        cardholderAddress == other.cardholderAddress &&
                        cardholderName == other.cardholderName &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        cardVerificationCode,
                        cardholderAddress,
                        cardholderName,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, cardholderName=$cardholderName, additionalProperties=$additionalProperties}"
            }

            override fun equals(other: Any?): Boolean {
                if (this === other) {
                    return true
                }

                return other is CardDecline &&
                    id == other.id &&
                    actioner == other.actioner &&
                    additionalAmounts == other.additionalAmounts &&
                    amount == other.amount &&
                    cardPaymentId == other.cardPaymentId &&
                    currency == other.currency &&
                    declinedTransactionId == other.declinedTransactionId &&
                    digitalWalletTokenId == other.digitalWalletTokenId &&
                    direction == other.direction &&
                    incrementedCardAuthorizationId == other.incrementedCardAuthorizationId &&
                    merchantAcceptorId == other.merchantAcceptorId &&
                    merchantCategoryCode == other.merchantCategoryCode &&
                    merchantCity == other.merchantCity &&
                    merchantCountry == other.merchantCountry &&
                    merchantDescriptor == other.merchantDescriptor &&
                    merchantPostalCode == other.merchantPostalCode &&
                    merchantState == other.merchantState &&
                    networkDetails == other.networkDetails &&
                    networkIdentifiers == other.networkIdentifiers &&
                    networkRiskScore == other.networkRiskScore &&
                    physicalCardId == other.physicalCardId &&
                    presentmentAmount == other.presentmentAmount &&
                    presentmentCurrency == other.presentmentCurrency &&
                    processingCategory == other.processingCategory &&
                    realTimeDecisionId == other.realTimeDecisionId &&
                    realTimeDecisionReason == other.realTimeDecisionReason &&
                    reason == other.reason &&
                    schemeFees == other.schemeFees &&
                    terminalId == other.terminalId &&
                    verification == other.verification &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    id,
                    actioner,
                    additionalAmounts,
                    amount,
                    cardPaymentId,
                    currency,
                    declinedTransactionId,
                    digitalWalletTokenId,
                    direction,
                    incrementedCardAuthorizationId,
                    merchantAcceptorId,
                    merchantCategoryCode,
                    merchantCity,
                    merchantCountry,
                    merchantDescriptor,
                    merchantPostalCode,
                    merchantState,
                    networkDetails,
                    networkIdentifiers,
                    networkRiskScore,
                    physicalCardId,
                    presentmentAmount,
                    presentmentCurrency,
                    processingCategory,
                    realTimeDecisionId,
                    realTimeDecisionReason,
                    reason,
                    schemeFees,
                    terminalId,
                    verification,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardDecline{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, declinedTransactionId=$declinedTransactionId, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, incrementedCardAuthorizationId=$incrementedCardAuthorizationId, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, realTimeDecisionId=$realTimeDecisionId, realTimeDecisionReason=$realTimeDecisionReason, reason=$reason, schemeFees=$schemeFees, terminalId=$terminalId, verification=$verification, additionalProperties=$additionalProperties}"
        }

        /**
         * A Card Financial object. This field will be present in the JSON response if and only if
         * `category` is equal to `card_financial`. Card Financials are card transactions that have
         * cleared and settled. Unlike a Card Settlement, which clears a previous authorization, a
         * Card Financial is authorized and cleared in a single message.
         */
        class CardFinancial
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val id: JsonField<String>,
            private val actioner: JsonField<Actioner>,
            private val additionalAmounts: JsonField<AdditionalAmounts>,
            private val amount: JsonField<Long>,
            private val cardPaymentId: JsonField<String>,
            private val currency: JsonField<Currency>,
            private val digitalWalletTokenId: JsonField<String>,
            private val direction: JsonField<Direction>,
            private val merchantAcceptorId: JsonField<String>,
            private val merchantCategoryCode: JsonField<String>,
            private val merchantCity: JsonField<String>,
            private val merchantCountry: JsonField<String>,
            private val merchantDescriptor: JsonField<String>,
            private val merchantPostalCode: JsonField<String>,
            private val merchantState: JsonField<String>,
            private val networkDetails: JsonField<NetworkDetails>,
            private val networkIdentifiers: JsonField<NetworkIdentifiers>,
            private val networkRiskScore: JsonField<Long>,
            private val physicalCardId: JsonField<String>,
            private val presentmentAmount: JsonField<Long>,
            private val presentmentCurrency: JsonField<String>,
            private val processingCategory: JsonField<ProcessingCategory>,
            private val realTimeDecisionId: JsonField<String>,
            private val schemeFees: JsonField<List<SchemeFee>>,
            private val terminalId: JsonField<String>,
            private val transactionId: JsonField<String>,
            private val type: JsonField<Type>,
            private val verification: JsonField<Verification>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
                @JsonProperty("actioner")
                @ExcludeMissing
                actioner: JsonField<Actioner> = JsonMissing.of(),
                @JsonProperty("additional_amounts")
                @ExcludeMissing
                additionalAmounts: JsonField<AdditionalAmounts> = JsonMissing.of(),
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("card_payment_id")
                @ExcludeMissing
                cardPaymentId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("digital_wallet_token_id")
                @ExcludeMissing
                digitalWalletTokenId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("direction")
                @ExcludeMissing
                direction: JsonField<Direction> = JsonMissing.of(),
                @JsonProperty("merchant_acceptor_id")
                @ExcludeMissing
                merchantAcceptorId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_category_code")
                @ExcludeMissing
                merchantCategoryCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_city")
                @ExcludeMissing
                merchantCity: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_country")
                @ExcludeMissing
                merchantCountry: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_descriptor")
                @ExcludeMissing
                merchantDescriptor: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_postal_code")
                @ExcludeMissing
                merchantPostalCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_state")
                @ExcludeMissing
                merchantState: JsonField<String> = JsonMissing.of(),
                @JsonProperty("network_details")
                @ExcludeMissing
                networkDetails: JsonField<NetworkDetails> = JsonMissing.of(),
                @JsonProperty("network_identifiers")
                @ExcludeMissing
                networkIdentifiers: JsonField<NetworkIdentifiers> = JsonMissing.of(),
                @JsonProperty("network_risk_score")
                @ExcludeMissing
                networkRiskScore: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("physical_card_id")
                @ExcludeMissing
                physicalCardId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("presentment_amount")
                @ExcludeMissing
                presentmentAmount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("presentment_currency")
                @ExcludeMissing
                presentmentCurrency: JsonField<String> = JsonMissing.of(),
                @JsonProperty("processing_category")
                @ExcludeMissing
                processingCategory: JsonField<ProcessingCategory> = JsonMissing.of(),
                @JsonProperty("real_time_decision_id")
                @ExcludeMissing
                realTimeDecisionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("scheme_fees")
                @ExcludeMissing
                schemeFees: JsonField<List<SchemeFee>> = JsonMissing.of(),
                @JsonProperty("terminal_id")
                @ExcludeMissing
                terminalId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transaction_id")
                @ExcludeMissing
                transactionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
                @JsonProperty("verification")
                @ExcludeMissing
                verification: JsonField<Verification> = JsonMissing.of(),
            ) : this(
                id,
                actioner,
                additionalAmounts,
                amount,
                cardPaymentId,
                currency,
                digitalWalletTokenId,
                direction,
                merchantAcceptorId,
                merchantCategoryCode,
                merchantCity,
                merchantCountry,
                merchantDescriptor,
                merchantPostalCode,
                merchantState,
                networkDetails,
                networkIdentifiers,
                networkRiskScore,
                physicalCardId,
                presentmentAmount,
                presentmentCurrency,
                processingCategory,
                realTimeDecisionId,
                schemeFees,
                terminalId,
                transactionId,
                type,
                verification,
                mutableMapOf(),
            )

            /**
             * The Card Financial identifier.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun id(): String = id.getRequired("id")

            /**
             * Whether this financial was approved by Increase, the card network through stand-in
             * processing, or the user through a real-time decision.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun actioner(): Actioner = actioner.getRequired("actioner")

            /**
             * Additional amounts associated with the card authorization, such as ATM surcharges
             * fees. These are usually a subset of the `amount` field and are used to provide more
             * detailed information about the transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun additionalAmounts(): AdditionalAmounts =
                additionalAmounts.getRequired("additional_amounts")

            /**
             * The pending amount in the minor unit of the transaction's currency. For dollars, for
             * example, this is cents.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun amount(): Long = amount.getRequired("amount")

            /**
             * The ID of the Card Payment this transaction belongs to.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun cardPaymentId(): String = cardPaymentId.getRequired("card_payment_id")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
             * currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun currency(): Currency = currency.getRequired("currency")

            /**
             * If the authorization was made via a Digital Wallet Token (such as an Apple Pay
             * purchase), the identifier of the token that was used.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun digitalWalletTokenId(): Optional<String> =
                digitalWalletTokenId.getOptional("digital_wallet_token_id")

            /**
             * The direction describes the direction the funds will move, either from the cardholder
             * to the merchant or from the merchant to the cardholder.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun direction(): Direction = direction.getRequired("direction")

            /**
             * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantAcceptorId(): String =
                merchantAcceptorId.getRequired("merchant_acceptor_id")

            /**
             * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCategoryCode(): String =
                merchantCategoryCode.getRequired("merchant_category_code")

            /**
             * The city the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantCity(): Optional<String> = merchantCity.getOptional("merchant_city")

            /**
             * The country the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCountry(): String = merchantCountry.getRequired("merchant_country")

            /**
             * The merchant descriptor of the merchant the card is transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantDescriptor(): String = merchantDescriptor.getRequired("merchant_descriptor")

            /**
             * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit ZIP
             * code, where the first 5 and last 4 are separated by a dash.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantPostalCode(): Optional<String> =
                merchantPostalCode.getOptional("merchant_postal_code")

            /**
             * The state the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantState(): Optional<String> = merchantState.getOptional("merchant_state")

            /**
             * Fields specific to the `network`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details")

            /**
             * Network-specific identifiers for a specific request or transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun networkIdentifiers(): NetworkIdentifiers =
                networkIdentifiers.getRequired("network_identifiers")

            /**
             * The risk score generated by the card network. For Visa this is the Visa Advanced
             * Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the score
             * is from 0 to 999, where 999 is the riskiest.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun networkRiskScore(): Optional<Long> =
                networkRiskScore.getOptional("network_risk_score")

            /**
             * If the authorization was made in-person with a physical card, the Physical Card that
             * was used.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun physicalCardId(): Optional<String> = physicalCardId.getOptional("physical_card_id")

            /**
             * The pending amount in the minor unit of the transaction's presentment currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun presentmentAmount(): Long = presentmentAmount.getRequired("presentment_amount")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
             * presentment currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun presentmentCurrency(): String =
                presentmentCurrency.getRequired("presentment_currency")

            /**
             * The processing category describes the intent behind the financial, such as whether it
             * was used for bill payments or an automatic fuel dispenser.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun processingCategory(): ProcessingCategory =
                processingCategory.getRequired("processing_category")

            /**
             * The identifier of the Real-Time Decision sent to approve or decline this transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun realTimeDecisionId(): Optional<String> =
                realTimeDecisionId.getOptional("real_time_decision_id")

            /**
             * The scheme fees associated with this card financial.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun schemeFees(): List<SchemeFee> = schemeFees.getRequired("scheme_fees")

            /**
             * The terminal identifier (commonly abbreviated as TID) of the terminal the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun terminalId(): Optional<String> = terminalId.getOptional("terminal_id")

            /**
             * The identifier of the Transaction associated with this Transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun transactionId(): String = transactionId.getRequired("transaction_id")

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_financial`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun type(): Type = type.getRequired("type")

            /**
             * Fields related to verification of cardholder-provided values.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun verification(): Verification = verification.getRequired("verification")

            /**
             * Returns the raw JSON value of [id].
             *
             * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id

            /**
             * Returns the raw JSON value of [actioner].
             *
             * Unlike [actioner], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("actioner")
            @ExcludeMissing
            fun _actioner(): JsonField<Actioner> = actioner

            /**
             * Returns the raw JSON value of [additionalAmounts].
             *
             * Unlike [additionalAmounts], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("additional_amounts")
            @ExcludeMissing
            fun _additionalAmounts(): JsonField<AdditionalAmounts> = additionalAmounts

            /**
             * Returns the raw JSON value of [amount].
             *
             * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

            /**
             * Returns the raw JSON value of [cardPaymentId].
             *
             * Unlike [cardPaymentId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("card_payment_id")
            @ExcludeMissing
            fun _cardPaymentId(): JsonField<String> = cardPaymentId

            /**
             * Returns the raw JSON value of [currency].
             *
             * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("currency")
            @ExcludeMissing
            fun _currency(): JsonField<Currency> = currency

            /**
             * Returns the raw JSON value of [digitalWalletTokenId].
             *
             * Unlike [digitalWalletTokenId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("digital_wallet_token_id")
            @ExcludeMissing
            fun _digitalWalletTokenId(): JsonField<String> = digitalWalletTokenId

            /**
             * Returns the raw JSON value of [direction].
             *
             * Unlike [direction], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("direction")
            @ExcludeMissing
            fun _direction(): JsonField<Direction> = direction

            /**
             * Returns the raw JSON value of [merchantAcceptorId].
             *
             * Unlike [merchantAcceptorId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_acceptor_id")
            @ExcludeMissing
            fun _merchantAcceptorId(): JsonField<String> = merchantAcceptorId

            /**
             * Returns the raw JSON value of [merchantCategoryCode].
             *
             * Unlike [merchantCategoryCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_category_code")
            @ExcludeMissing
            fun _merchantCategoryCode(): JsonField<String> = merchantCategoryCode

            /**
             * Returns the raw JSON value of [merchantCity].
             *
             * Unlike [merchantCity], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_city")
            @ExcludeMissing
            fun _merchantCity(): JsonField<String> = merchantCity

            /**
             * Returns the raw JSON value of [merchantCountry].
             *
             * Unlike [merchantCountry], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_country")
            @ExcludeMissing
            fun _merchantCountry(): JsonField<String> = merchantCountry

            /**
             * Returns the raw JSON value of [merchantDescriptor].
             *
             * Unlike [merchantDescriptor], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_descriptor")
            @ExcludeMissing
            fun _merchantDescriptor(): JsonField<String> = merchantDescriptor

            /**
             * Returns the raw JSON value of [merchantPostalCode].
             *
             * Unlike [merchantPostalCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_postal_code")
            @ExcludeMissing
            fun _merchantPostalCode(): JsonField<String> = merchantPostalCode

            /**
             * Returns the raw JSON value of [merchantState].
             *
             * Unlike [merchantState], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_state")
            @ExcludeMissing
            fun _merchantState(): JsonField<String> = merchantState

            /**
             * Returns the raw JSON value of [networkDetails].
             *
             * Unlike [networkDetails], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_details")
            @ExcludeMissing
            fun _networkDetails(): JsonField<NetworkDetails> = networkDetails

            /**
             * Returns the raw JSON value of [networkIdentifiers].
             *
             * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_identifiers")
            @ExcludeMissing
            fun _networkIdentifiers(): JsonField<NetworkIdentifiers> = networkIdentifiers

            /**
             * Returns the raw JSON value of [networkRiskScore].
             *
             * Unlike [networkRiskScore], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_risk_score")
            @ExcludeMissing
            fun _networkRiskScore(): JsonField<Long> = networkRiskScore

            /**
             * Returns the raw JSON value of [physicalCardId].
             *
             * Unlike [physicalCardId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("physical_card_id")
            @ExcludeMissing
            fun _physicalCardId(): JsonField<String> = physicalCardId

            /**
             * Returns the raw JSON value of [presentmentAmount].
             *
             * Unlike [presentmentAmount], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("presentment_amount")
            @ExcludeMissing
            fun _presentmentAmount(): JsonField<Long> = presentmentAmount

            /**
             * Returns the raw JSON value of [presentmentCurrency].
             *
             * Unlike [presentmentCurrency], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("presentment_currency")
            @ExcludeMissing
            fun _presentmentCurrency(): JsonField<String> = presentmentCurrency

            /**
             * Returns the raw JSON value of [processingCategory].
             *
             * Unlike [processingCategory], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("processing_category")
            @ExcludeMissing
            fun _processingCategory(): JsonField<ProcessingCategory> = processingCategory

            /**
             * Returns the raw JSON value of [realTimeDecisionId].
             *
             * Unlike [realTimeDecisionId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("real_time_decision_id")
            @ExcludeMissing
            fun _realTimeDecisionId(): JsonField<String> = realTimeDecisionId

            /**
             * Returns the raw JSON value of [schemeFees].
             *
             * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("scheme_fees")
            @ExcludeMissing
            fun _schemeFees(): JsonField<List<SchemeFee>> = schemeFees

            /**
             * Returns the raw JSON value of [terminalId].
             *
             * Unlike [terminalId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("terminal_id")
            @ExcludeMissing
            fun _terminalId(): JsonField<String> = terminalId

            /**
             * Returns the raw JSON value of [transactionId].
             *
             * Unlike [transactionId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("transaction_id")
            @ExcludeMissing
            fun _transactionId(): JsonField<String> = transactionId

            /**
             * Returns the raw JSON value of [type].
             *
             * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("type") @ExcludeMissing fun _type(): JsonField<Type> = type

            /**
             * Returns the raw JSON value of [verification].
             *
             * Unlike [verification], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("verification")
            @ExcludeMissing
            fun _verification(): JsonField<Verification> = verification

            @JsonAnySetter
            private fun putAdditionalProperty(key: String, value: JsonValue) {
                additionalProperties.put(key, value)
            }

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map<String, JsonValue> =
                Collections.unmodifiableMap(additionalProperties)

            fun toBuilder() = Builder().from(this)

            companion object {

                /**
                 * Returns a mutable builder for constructing an instance of [CardFinancial].
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .actioner()
                 * .additionalAmounts()
                 * .amount()
                 * .cardPaymentId()
                 * .currency()
                 * .digitalWalletTokenId()
                 * .direction()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCity()
                 * .merchantCountry()
                 * .merchantDescriptor()
                 * .merchantPostalCode()
                 * .merchantState()
                 * .networkDetails()
                 * .networkIdentifiers()
                 * .networkRiskScore()
                 * .physicalCardId()
                 * .presentmentAmount()
                 * .presentmentCurrency()
                 * .processingCategory()
                 * .realTimeDecisionId()
                 * .schemeFees()
                 * .terminalId()
                 * .transactionId()
                 * .type()
                 * .verification()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

            /** A builder for [CardFinancial]. */
            class Builder internal constructor() {

                private var id: JsonField<String>? = null
                private var actioner: JsonField<Actioner>? = null
                private var additionalAmounts: JsonField<AdditionalAmounts>? = null
                private var amount: JsonField<Long>? = null
                private var cardPaymentId: JsonField<String>? = null
                private var currency: JsonField<Currency>? = null
                private var digitalWalletTokenId: JsonField<String>? = null
                private var direction: JsonField<Direction>? = null
                private var merchantAcceptorId: JsonField<String>? = null
                private var merchantCategoryCode: JsonField<String>? = null
                private var merchantCity: JsonField<String>? = null
                private var merchantCountry: JsonField<String>? = null
                private var merchantDescriptor: JsonField<String>? = null
                private var merchantPostalCode: JsonField<String>? = null
                private var merchantState: JsonField<String>? = null
                private var networkDetails: JsonField<NetworkDetails>? = null
                private var networkIdentifiers: JsonField<NetworkIdentifiers>? = null
                private var networkRiskScore: JsonField<Long>? = null
                private var physicalCardId: JsonField<String>? = null
                private var presentmentAmount: JsonField<Long>? = null
                private var presentmentCurrency: JsonField<String>? = null
                private var processingCategory: JsonField<ProcessingCategory>? = null
                private var realTimeDecisionId: JsonField<String>? = null
                private var schemeFees: JsonField<MutableList<SchemeFee>>? = null
                private var terminalId: JsonField<String>? = null
                private var transactionId: JsonField<String>? = null
                private var type: JsonField<Type>? = null
                private var verification: JsonField<Verification>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardFinancial: CardFinancial) = apply {
                    id = cardFinancial.id
                    actioner = cardFinancial.actioner
                    additionalAmounts = cardFinancial.additionalAmounts
                    amount = cardFinancial.amount
                    cardPaymentId = cardFinancial.cardPaymentId
                    currency = cardFinancial.currency
                    digitalWalletTokenId = cardFinancial.digitalWalletTokenId
                    direction = cardFinancial.direction
                    merchantAcceptorId = cardFinancial.merchantAcceptorId
                    merchantCategoryCode = cardFinancial.merchantCategoryCode
                    merchantCity = cardFinancial.merchantCity
                    merchantCountry = cardFinancial.merchantCountry
                    merchantDescriptor = cardFinancial.merchantDescriptor
                    merchantPostalCode = cardFinancial.merchantPostalCode
                    merchantState = cardFinancial.merchantState
                    networkDetails = cardFinancial.networkDetails
                    networkIdentifiers = cardFinancial.networkIdentifiers
                    networkRiskScore = cardFinancial.networkRiskScore
                    physicalCardId = cardFinancial.physicalCardId
                    presentmentAmount = cardFinancial.presentmentAmount
                    presentmentCurrency = cardFinancial.presentmentCurrency
                    processingCategory = cardFinancial.processingCategory
                    realTimeDecisionId = cardFinancial.realTimeDecisionId
                    schemeFees = cardFinancial.schemeFees.map { it.toMutableList() }
                    terminalId = cardFinancial.terminalId
                    transactionId = cardFinancial.transactionId
                    type = cardFinancial.type
                    verification = cardFinancial.verification
                    additionalProperties = cardFinancial.additionalProperties.toMutableMap()
                }

                /** The Card Financial identifier. */
                fun id(id: String) = id(JsonField.of(id))

                /**
                 * Sets [Builder.id] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.id] with a well-typed [String] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun id(id: JsonField<String>) = apply { this.id = id }

                /**
                 * Whether this financial was approved by Increase, the card network through
                 * stand-in processing, or the user through a real-time decision.
                 */
                fun actioner(actioner: Actioner) = actioner(JsonField.of(actioner))

                /**
                 * Sets [Builder.actioner] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.actioner] with a well-typed [Actioner] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun actioner(actioner: JsonField<Actioner>) = apply { this.actioner = actioner }

                /**
                 * Additional amounts associated with the card authorization, such as ATM surcharges
                 * fees. These are usually a subset of the `amount` field and are used to provide
                 * more detailed information about the transaction.
                 */
                fun additionalAmounts(additionalAmounts: AdditionalAmounts) =
                    additionalAmounts(JsonField.of(additionalAmounts))

                /**
                 * Sets [Builder.additionalAmounts] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.additionalAmounts] with a well-typed
                 * [AdditionalAmounts] value instead. This method is primarily for setting the field
                 * to an undocumented or not yet supported value.
                 */
                fun additionalAmounts(additionalAmounts: JsonField<AdditionalAmounts>) = apply {
                    this.additionalAmounts = additionalAmounts
                }

                /**
                 * The pending amount in the minor unit of the transaction's currency. For dollars,
                 * for example, this is cents.
                 */
                fun amount(amount: Long) = amount(JsonField.of(amount))

                /**
                 * Sets [Builder.amount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.amount] with a well-typed [Long] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                /** The ID of the Card Payment this transaction belongs to. */
                fun cardPaymentId(cardPaymentId: String) =
                    cardPaymentId(JsonField.of(cardPaymentId))

                /**
                 * Sets [Builder.cardPaymentId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cardPaymentId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun cardPaymentId(cardPaymentId: JsonField<String>) = apply {
                    this.cardPaymentId = cardPaymentId
                }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
                 * currency.
                 */
                fun currency(currency: Currency) = currency(JsonField.of(currency))

                /**
                 * Sets [Builder.currency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.currency] with a well-typed [Currency] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                /**
                 * If the authorization was made via a Digital Wallet Token (such as an Apple Pay
                 * purchase), the identifier of the token that was used.
                 */
                fun digitalWalletTokenId(digitalWalletTokenId: String?) =
                    digitalWalletTokenId(JsonField.ofNullable(digitalWalletTokenId))

                /**
                 * Alias for calling [Builder.digitalWalletTokenId] with
                 * `digitalWalletTokenId.orElse(null)`.
                 */
                fun digitalWalletTokenId(digitalWalletTokenId: Optional<String>) =
                    digitalWalletTokenId(digitalWalletTokenId.getOrNull())

                /**
                 * Sets [Builder.digitalWalletTokenId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.digitalWalletTokenId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun digitalWalletTokenId(digitalWalletTokenId: JsonField<String>) = apply {
                    this.digitalWalletTokenId = digitalWalletTokenId
                }

                /**
                 * The direction describes the direction the funds will move, either from the
                 * cardholder to the merchant or from the merchant to the cardholder.
                 */
                fun direction(direction: Direction) = direction(JsonField.of(direction))

                /**
                 * Sets [Builder.direction] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.direction] with a well-typed [Direction] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun direction(direction: JsonField<Direction>) = apply {
                    this.direction = direction
                }

                /**
                 * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
                 * transacting with.
                 */
                fun merchantAcceptorId(merchantAcceptorId: String) =
                    merchantAcceptorId(JsonField.of(merchantAcceptorId))

                /**
                 * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantAcceptorId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantAcceptorId(merchantAcceptorId: JsonField<String>) = apply {
                    this.merchantAcceptorId = merchantAcceptorId
                }

                /**
                 * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card
                 * is transacting with.
                 */
                fun merchantCategoryCode(merchantCategoryCode: String) =
                    merchantCategoryCode(JsonField.of(merchantCategoryCode))

                /**
                 * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCategoryCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCategoryCode(merchantCategoryCode: JsonField<String>) = apply {
                    this.merchantCategoryCode = merchantCategoryCode
                }

                /** The city the merchant resides in. */
                fun merchantCity(merchantCity: String?) =
                    merchantCity(JsonField.ofNullable(merchantCity))

                /** Alias for calling [Builder.merchantCity] with `merchantCity.orElse(null)`. */
                fun merchantCity(merchantCity: Optional<String>) =
                    merchantCity(merchantCity.getOrNull())

                /**
                 * Sets [Builder.merchantCity] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCity] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantCity(merchantCity: JsonField<String>) = apply {
                    this.merchantCity = merchantCity
                }

                /** The country the merchant resides in. */
                fun merchantCountry(merchantCountry: String) =
                    merchantCountry(JsonField.of(merchantCountry))

                /**
                 * Sets [Builder.merchantCountry] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCountry] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCountry(merchantCountry: JsonField<String>) = apply {
                    this.merchantCountry = merchantCountry
                }

                /** The merchant descriptor of the merchant the card is transacting with. */
                fun merchantDescriptor(merchantDescriptor: String) =
                    merchantDescriptor(JsonField.of(merchantDescriptor))

                /**
                 * Sets [Builder.merchantDescriptor] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantDescriptor] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantDescriptor(merchantDescriptor: JsonField<String>) = apply {
                    this.merchantDescriptor = merchantDescriptor
                }

                /**
                 * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit
                 * ZIP code, where the first 5 and last 4 are separated by a dash.
                 */
                fun merchantPostalCode(merchantPostalCode: String?) =
                    merchantPostalCode(JsonField.ofNullable(merchantPostalCode))

                /**
                 * Alias for calling [Builder.merchantPostalCode] with
                 * `merchantPostalCode.orElse(null)`.
                 */
                fun merchantPostalCode(merchantPostalCode: Optional<String>) =
                    merchantPostalCode(merchantPostalCode.getOrNull())

                /**
                 * Sets [Builder.merchantPostalCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantPostalCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantPostalCode(merchantPostalCode: JsonField<String>) = apply {
                    this.merchantPostalCode = merchantPostalCode
                }

                /** The state the merchant resides in. */
                fun merchantState(merchantState: String?) =
                    merchantState(JsonField.ofNullable(merchantState))

                /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */
                fun merchantState(merchantState: Optional<String>) =
                    merchantState(merchantState.getOrNull())

                /**
                 * Sets [Builder.merchantState] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantState] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantState(merchantState: JsonField<String>) = apply {
                    this.merchantState = merchantState
                }

                /** Fields specific to the `network`. */
                fun networkDetails(networkDetails: NetworkDetails) =
                    networkDetails(JsonField.of(networkDetails))

                /**
                 * Sets [Builder.networkDetails] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkDetails] with a well-typed
                 * [NetworkDetails] value instead. This method is primarily for setting the field to
                 * an undocumented or not yet supported value.
                 */
                fun networkDetails(networkDetails: JsonField<NetworkDetails>) = apply {
                    this.networkDetails = networkDetails
                }

                /** Network-specific identifiers for a specific request or transaction. */
                fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) =
                    networkIdentifiers(JsonField.of(networkIdentifiers))

                /**
                 * Sets [Builder.networkIdentifiers] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkIdentifiers] with a well-typed
                 * [NetworkIdentifiers] value instead. This method is primarily for setting the
                 * field to an undocumented or not yet supported value.
                 */
                fun networkIdentifiers(networkIdentifiers: JsonField<NetworkIdentifiers>) = apply {
                    this.networkIdentifiers = networkIdentifiers
                }

                /**
                 * The risk score generated by the card network. For Visa this is the Visa Advanced
                 * Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the
                 * score is from 0 to 999, where 999 is the riskiest.
                 */
                fun networkRiskScore(networkRiskScore: Long?) =
                    networkRiskScore(JsonField.ofNullable(networkRiskScore))

                /**
                 * Alias for [Builder.networkRiskScore].
                 *
                 * This unboxed primitive overload exists for backwards compatibility.
                 */
                fun networkRiskScore(networkRiskScore: Long) =
                    networkRiskScore(networkRiskScore as Long?)

                /**
                 * Alias for calling [Builder.networkRiskScore] with
                 * `networkRiskScore.orElse(null)`.
                 */
                fun networkRiskScore(networkRiskScore: Optional<Long>) =
                    networkRiskScore(networkRiskScore.getOrNull())

                /**
                 * Sets [Builder.networkRiskScore] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkRiskScore] with a well-typed [Long] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun networkRiskScore(networkRiskScore: JsonField<Long>) = apply {
                    this.networkRiskScore = networkRiskScore
                }

                /**
                 * If the authorization was made in-person with a physical card, the Physical Card
                 * that was used.
                 */
                fun physicalCardId(physicalCardId: String?) =
                    physicalCardId(JsonField.ofNullable(physicalCardId))

                /**
                 * Alias for calling [Builder.physicalCardId] with `physicalCardId.orElse(null)`.
                 */
                fun physicalCardId(physicalCardId: Optional<String>) =
                    physicalCardId(physicalCardId.getOrNull())

                /**
                 * Sets [Builder.physicalCardId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.physicalCardId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun physicalCardId(physicalCardId: JsonField<String>) = apply {
                    this.physicalCardId = physicalCardId
                }

                /**
                 * The pending amount in the minor unit of the transaction's presentment currency.
                 */
                fun presentmentAmount(presentmentAmount: Long) =
                    presentmentAmount(JsonField.of(presentmentAmount))

                /**
                 * Sets [Builder.presentmentAmount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.presentmentAmount] with a well-typed [Long]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun presentmentAmount(presentmentAmount: JsonField<Long>) = apply {
                    this.presentmentAmount = presentmentAmount
                }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
                 * presentment currency.
                 */
                fun presentmentCurrency(presentmentCurrency: String) =
                    presentmentCurrency(JsonField.of(presentmentCurrency))

                /**
                 * Sets [Builder.presentmentCurrency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.presentmentCurrency] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun presentmentCurrency(presentmentCurrency: JsonField<String>) = apply {
                    this.presentmentCurrency = presentmentCurrency
                }

                /**
                 * The processing category describes the intent behind the financial, such as
                 * whether it was used for bill payments or an automatic fuel dispenser.
                 */
                fun processingCategory(processingCategory: ProcessingCategory) =
                    processingCategory(JsonField.of(processingCategory))

                /**
                 * Sets [Builder.processingCategory] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.processingCategory] with a well-typed
                 * [ProcessingCategory] value instead. This method is primarily for setting the
                 * field to an undocumented or not yet supported value.
                 */
                fun processingCategory(processingCategory: JsonField<ProcessingCategory>) = apply {
                    this.processingCategory = processingCategory
                }

                /**
                 * The identifier of the Real-Time Decision sent to approve or decline this
                 * transaction.
                 */
                fun realTimeDecisionId(realTimeDecisionId: String?) =
                    realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId))

                /**
                 * Alias for calling [Builder.realTimeDecisionId] with
                 * `realTimeDecisionId.orElse(null)`.
                 */
                fun realTimeDecisionId(realTimeDecisionId: Optional<String>) =
                    realTimeDecisionId(realTimeDecisionId.getOrNull())

                /**
                 * Sets [Builder.realTimeDecisionId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.realTimeDecisionId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun realTimeDecisionId(realTimeDecisionId: JsonField<String>) = apply {
                    this.realTimeDecisionId = realTimeDecisionId
                }

                /** The scheme fees associated with this card financial. */
                fun schemeFees(schemeFees: List<SchemeFee>) = schemeFees(JsonField.of(schemeFees))

                /**
                 * Sets [Builder.schemeFees] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.schemeFees] with a well-typed `List<SchemeFee>`
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun schemeFees(schemeFees: JsonField<List<SchemeFee>>) = apply {
                    this.schemeFees = schemeFees.map { it.toMutableList() }
                }

                /**
                 * Adds a single [SchemeFee] to [schemeFees].
                 *
                 * @throws IllegalStateException if the field was previously set to a non-list.
                 */
                fun addSchemeFee(schemeFee: SchemeFee) = apply {
                    schemeFees =
                        (schemeFees ?: JsonField.of(mutableListOf())).also {
                            checkKnown("schemeFees", it).add(schemeFee)
                        }
                }

                /**
                 * The terminal identifier (commonly abbreviated as TID) of the terminal the card is
                 * transacting with.
                 */
                fun terminalId(terminalId: String?) = terminalId(JsonField.ofNullable(terminalId))

                /** Alias for calling [Builder.terminalId] with `terminalId.orElse(null)`. */
                fun terminalId(terminalId: Optional<String>) = terminalId(terminalId.getOrNull())

                /**
                 * Sets [Builder.terminalId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.terminalId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun terminalId(terminalId: JsonField<String>) = apply {
                    this.terminalId = terminalId
                }

                /** The identifier of the Transaction associated with this Transaction. */
                fun transactionId(transactionId: String) =
                    transactionId(JsonField.of(transactionId))

                /**
                 * Sets [Builder.transactionId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.transactionId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun transactionId(transactionId: JsonField<String>) = apply {
                    this.transactionId = transactionId
                }

                /**
                 * A constant representing the object's type. For this resource it will always be
                 * `card_financial`.
                 */
                fun type(type: Type) = type(JsonField.of(type))

                /**
                 * Sets [Builder.type] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.type] with a well-typed [Type] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun type(type: JsonField<Type>) = apply { this.type = type }

                /** Fields related to verification of cardholder-provided values. */
                fun verification(verification: Verification) =
                    verification(JsonField.of(verification))

                /**
                 * Sets [Builder.verification] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.verification] with a well-typed [Verification]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun verification(verification: JsonField<Verification>) = apply {
                    this.verification = verification
                }

                fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                    this.additionalProperties.clear()
                    putAllAdditionalProperties(additionalProperties)
                }

                fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                    additionalProperties.put(key, value)
                }

                fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun removeAdditionalProperty(key: String) = apply {
                    additionalProperties.remove(key)
                }

                fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                    keys.forEach(::removeAdditionalProperty)
                }

                /**
                 * Returns an immutable instance of [CardFinancial].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .actioner()
                 * .additionalAmounts()
                 * .amount()
                 * .cardPaymentId()
                 * .currency()
                 * .digitalWalletTokenId()
                 * .direction()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCity()
                 * .merchantCountry()
                 * .merchantDescriptor()
                 * .merchantPostalCode()
                 * .merchantState()
                 * .networkDetails()
                 * .networkIdentifiers()
                 * .networkRiskScore()
                 * .physicalCardId()
                 * .presentmentAmount()
                 * .presentmentCurrency()
                 * .processingCategory()
                 * .realTimeDecisionId()
                 * .schemeFees()
                 * .terminalId()
                 * .transactionId()
                 * .type()
                 * .verification()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardFinancial =
                    CardFinancial(
                        checkRequired("id", id),
                        checkRequired("actioner", actioner),
                        checkRequired("additionalAmounts", additionalAmounts),
                        checkRequired("amount", amount),
                        checkRequired("cardPaymentId", cardPaymentId),
                        checkRequired("currency", currency),
                        checkRequired("digitalWalletTokenId", digitalWalletTokenId),
                        checkRequired("direction", direction),
                        checkRequired("merchantAcceptorId", merchantAcceptorId),
                        checkRequired("merchantCategoryCode", merchantCategoryCode),
                        checkRequired("merchantCity", merchantCity),
                        checkRequired("merchantCountry", merchantCountry),
                        checkRequired("merchantDescriptor", merchantDescriptor),
                        checkRequired("merchantPostalCode", merchantPostalCode),
                        checkRequired("merchantState", merchantState),
                        checkRequired("networkDetails", networkDetails),
                        checkRequired("networkIdentifiers", networkIdentifiers),
                        checkRequired("networkRiskScore", networkRiskScore),
                        checkRequired("physicalCardId", physicalCardId),
                        checkRequired("presentmentAmount", presentmentAmount),
                        checkRequired("presentmentCurrency", presentmentCurrency),
                        checkRequired("processingCategory", processingCategory),
                        checkRequired("realTimeDecisionId", realTimeDecisionId),
                        checkRequired("schemeFees", schemeFees).map { it.toImmutable() },
                        checkRequired("terminalId", terminalId),
                        checkRequired("transactionId", transactionId),
                        checkRequired("type", type),
                        checkRequired("verification", verification),
                        additionalProperties.toMutableMap(),
                    )
            }

            private var validated: Boolean = false

            /**
             * Validates that the types of all values in this object match their expected types
             * recursively.
             *
             * This method is _not_ forwards compatible with new types from the API for existing
             * fields.
             *
             * @throws IncreaseInvalidDataException if any value type in this object doesn't match
             *   its expected type.
             */
            fun validate(): CardFinancial = apply {
                if (validated) {
                    return@apply
                }

                id()
                actioner().validate()
                additionalAmounts().validate()
                amount()
                cardPaymentId()
                currency().validate()
                digitalWalletTokenId()
                direction().validate()
                merchantAcceptorId()
                merchantCategoryCode()
                merchantCity()
                merchantCountry()
                merchantDescriptor()
                merchantPostalCode()
                merchantState()
                networkDetails().validate()
                networkIdentifiers().validate()
                networkRiskScore()
                physicalCardId()
                presentmentAmount()
                presentmentCurrency()
                processingCategory().validate()
                realTimeDecisionId()
                schemeFees().forEach { it.validate() }
                terminalId()
                transactionId()
                type().validate()
                verification().validate()
                validated = true
            }

            fun isValid(): Boolean =
                try {
                    validate()
                    true
                } catch (e: IncreaseInvalidDataException) {
                    false
                }

            /**
             * Returns a score indicating how many valid values are contained in this object
             * recursively.
             *
             * Used for best match union deserialization.
             */
            @JvmSynthetic
            internal fun validity(): Int =
                (if (id.asKnown().isPresent) 1 else 0) +
                    (actioner.asKnown().getOrNull()?.validity() ?: 0) +
                    (additionalAmounts.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (amount.asKnown().isPresent) 1 else 0) +
                    (if (cardPaymentId.asKnown().isPresent) 1 else 0) +
                    (currency.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (digitalWalletTokenId.asKnown().isPresent) 1 else 0) +
                    (direction.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) +
                    (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantCity.asKnown().isPresent) 1 else 0) +
                    (if (merchantCountry.asKnown().isPresent) 1 else 0) +
                    (if (merchantDescriptor.asKnown().isPresent) 1 else 0) +
                    (if (merchantPostalCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantState.asKnown().isPresent) 1 else 0) +
                    (networkDetails.asKnown().getOrNull()?.validity() ?: 0) +
                    (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (networkRiskScore.asKnown().isPresent) 1 else 0) +
                    (if (physicalCardId.asKnown().isPresent) 1 else 0) +
                    (if (presentmentAmount.asKnown().isPresent) 1 else 0) +
                    (if (presentmentCurrency.asKnown().isPresent) 1 else 0) +
                    (processingCategory.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) +
                    (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
                    (if (terminalId.asKnown().isPresent) 1 else 0) +
                    (if (transactionId.asKnown().isPresent) 1 else 0) +
                    (type.asKnown().getOrNull()?.validity() ?: 0) +
                    (verification.asKnown().getOrNull()?.validity() ?: 0)

            /**
             * Whether this financial was approved by Increase, the card network through stand-in
             * processing, or the user through a real-time decision.
             */
            class Actioner @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** This object was actioned by the user through a real-time decision. */
                    @JvmField val USER = of("user")

                    /** This object was actioned by Increase without user intervention. */
                    @JvmField val INCREASE = of("increase")

                    /** This object was actioned by the network, through stand-in processing. */
                    @JvmField val NETWORK = of("network")

                    @JvmStatic fun of(value: String) = Actioner(JsonField.of(value))
                }

                /** An enum containing [Actioner]'s known values. */
                enum class Known {
                    /** This object was actioned by the user through a real-time decision. */
                    USER,
                    /** This object was actioned by Increase without user intervention. */
                    INCREASE,
                    /** This object was actioned by the network, through stand-in processing. */
                    NETWORK,
                }

                /**
                 * An enum containing [Actioner]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Actioner] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** This object was actioned by the user through a real-time decision. */
                    USER,
                    /** This object was actioned by Increase without user intervention. */
                    INCREASE,
                    /** This object was actioned by the network, through stand-in processing. */
                    NETWORK,
                    /**
                     * An enum member indicating that [Actioner] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        USER -> Value.USER
                        INCREASE -> Value.INCREASE
                        NETWORK -> Value.NETWORK
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        USER -> Known.USER
                        INCREASE -> Known.INCREASE
                        NETWORK -> Known.NETWORK
                        else -> throw IncreaseInvalidDataException("Unknown Actioner: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Actioner = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Actioner && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /**
             * Additional amounts associated with the card authorization, such as ATM surcharges
             * fees. These are usually a subset of the `amount` field and are used to provide more
             * detailed information about the transaction.
             */
            class AdditionalAmounts
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val clinic: JsonField<Clinic>,
                private val dental: JsonField<Dental>,
                private val original: JsonField<Original>,
                private val prescription: JsonField<Prescription>,
                private val surcharge: JsonField<Surcharge>,
                private val totalCumulative: JsonField<TotalCumulative>,
                private val totalHealthcare: JsonField<TotalHealthcare>,
                private val transit: JsonField<Transit>,
                private val unknown: JsonField<Unknown>,
                private val vision: JsonField<Vision>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("clinic")
                    @ExcludeMissing
                    clinic: JsonField<Clinic> = JsonMissing.of(),
                    @JsonProperty("dental")
                    @ExcludeMissing
                    dental: JsonField<Dental> = JsonMissing.of(),
                    @JsonProperty("original")
                    @ExcludeMissing
                    original: JsonField<Original> = JsonMissing.of(),
                    @JsonProperty("prescription")
                    @ExcludeMissing
                    prescription: JsonField<Prescription> = JsonMissing.of(),
                    @JsonProperty("surcharge")
                    @ExcludeMissing
                    surcharge: JsonField<Surcharge> = JsonMissing.of(),
                    @JsonProperty("total_cumulative")
                    @ExcludeMissing
                    totalCumulative: JsonField<TotalCumulative> = JsonMissing.of(),
                    @JsonProperty("total_healthcare")
                    @ExcludeMissing
                    totalHealthcare: JsonField<TotalHealthcare> = JsonMissing.of(),
                    @JsonProperty("transit")
                    @ExcludeMissing
                    transit: JsonField<Transit> = JsonMissing.of(),
                    @JsonProperty("unknown")
                    @ExcludeMissing
                    unknown: JsonField<Unknown> = JsonMissing.of(),
                    @JsonProperty("vision")
                    @ExcludeMissing
                    vision: JsonField<Vision> = JsonMissing.of(),
                ) : this(
                    clinic,
                    dental,
                    original,
                    prescription,
                    surcharge,
                    totalCumulative,
                    totalHealthcare,
                    transit,
                    unknown,
                    vision,
                    mutableMapOf(),
                )

                /**
                 * The part of this transaction amount that was for clinic-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun clinic(): Optional<Clinic> = clinic.getOptional("clinic")

                /**
                 * The part of this transaction amount that was for dental-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun dental(): Optional<Dental> = dental.getOptional("dental")

                /**
                 * The original pre-authorized amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun original(): Optional<Original> = original.getOptional("original")

                /**
                 * The part of this transaction amount that was for healthcare prescriptions.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun prescription(): Optional<Prescription> =
                    prescription.getOptional("prescription")

                /**
                 * The surcharge amount charged for this transaction by the merchant.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun surcharge(): Optional<Surcharge> = surcharge.getOptional("surcharge")

                /**
                 * The total amount of a series of incremental authorizations, optionally provided.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun totalCumulative(): Optional<TotalCumulative> =
                    totalCumulative.getOptional("total_cumulative")

                /**
                 * The total amount of healthcare-related additional amounts.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun totalHealthcare(): Optional<TotalHealthcare> =
                    totalHealthcare.getOptional("total_healthcare")

                /**
                 * The part of this transaction amount that was for transit-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun transit(): Optional<Transit> = transit.getOptional("transit")

                /**
                 * An unknown additional amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun unknown(): Optional<Unknown> = unknown.getOptional("unknown")

                /**
                 * The part of this transaction amount that was for vision-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun vision(): Optional<Vision> = vision.getOptional("vision")

                /**
                 * Returns the raw JSON value of [clinic].
                 *
                 * Unlike [clinic], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("clinic") @ExcludeMissing fun _clinic(): JsonField<Clinic> = clinic

                /**
                 * Returns the raw JSON value of [dental].
                 *
                 * Unlike [dental], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("dental") @ExcludeMissing fun _dental(): JsonField<Dental> = dental

                /**
                 * Returns the raw JSON value of [original].
                 *
                 * Unlike [original], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("original")
                @ExcludeMissing
                fun _original(): JsonField<Original> = original

                /**
                 * Returns the raw JSON value of [prescription].
                 *
                 * Unlike [prescription], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("prescription")
                @ExcludeMissing
                fun _prescription(): JsonField<Prescription> = prescription

                /**
                 * Returns the raw JSON value of [surcharge].
                 *
                 * Unlike [surcharge], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("surcharge")
                @ExcludeMissing
                fun _surcharge(): JsonField<Surcharge> = surcharge

                /**
                 * Returns the raw JSON value of [totalCumulative].
                 *
                 * Unlike [totalCumulative], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("total_cumulative")
                @ExcludeMissing
                fun _totalCumulative(): JsonField<TotalCumulative> = totalCumulative

                /**
                 * Returns the raw JSON value of [totalHealthcare].
                 *
                 * Unlike [totalHealthcare], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("total_healthcare")
                @ExcludeMissing
                fun _totalHealthcare(): JsonField<TotalHealthcare> = totalHealthcare

                /**
                 * Returns the raw JSON value of [transit].
                 *
                 * Unlike [transit], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("transit")
                @ExcludeMissing
                fun _transit(): JsonField<Transit> = transit

                /**
                 * Returns the raw JSON value of [unknown].
                 *
                 * Unlike [unknown], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("unknown")
                @ExcludeMissing
                fun _unknown(): JsonField<Unknown> = unknown

                /**
                 * Returns the raw JSON value of [vision].
                 *
                 * Unlike [vision], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("vision") @ExcludeMissing fun _vision(): JsonField<Vision> = vision

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of
                     * [AdditionalAmounts].
                     *
                     * The following fields are required:
                     * ```java
                     * .clinic()
                     * .dental()
                     * .original()
                     * .prescription()
                     * .surcharge()
                     * .totalCumulative()
                     * .totalHealthcare()
                     * .transit()
                     * .unknown()
                     * .vision()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [AdditionalAmounts]. */
                class Builder internal constructor() {

                    private var clinic: JsonField<Clinic>? = null
                    private var dental: JsonField<Dental>? = null
                    private var original: JsonField<Original>? = null
                    private var prescription: JsonField<Prescription>? = null
                    private var surcharge: JsonField<Surcharge>? = null
                    private var totalCumulative: JsonField<TotalCumulative>? = null
                    private var totalHealthcare: JsonField<TotalHealthcare>? = null
                    private var transit: JsonField<Transit>? = null
                    private var unknown: JsonField<Unknown>? = null
                    private var vision: JsonField<Vision>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(additionalAmounts: AdditionalAmounts) = apply {
                        clinic = additionalAmounts.clinic
                        dental = additionalAmounts.dental
                        original = additionalAmounts.original
                        prescription = additionalAmounts.prescription
                        surcharge = additionalAmounts.surcharge
                        totalCumulative = additionalAmounts.totalCumulative
                        totalHealthcare = additionalAmounts.totalHealthcare
                        transit = additionalAmounts.transit
                        unknown = additionalAmounts.unknown
                        vision = additionalAmounts.vision
                        additionalProperties = additionalAmounts.additionalProperties.toMutableMap()
                    }

                    /** The part of this transaction amount that was for clinic-related services. */
                    fun clinic(clinic: Clinic?) = clinic(JsonField.ofNullable(clinic))

                    /** Alias for calling [Builder.clinic] with `clinic.orElse(null)`. */
                    fun clinic(clinic: Optional<Clinic>) = clinic(clinic.getOrNull())

                    /**
                     * Sets [Builder.clinic] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.clinic] with a well-typed [Clinic] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun clinic(clinic: JsonField<Clinic>) = apply { this.clinic = clinic }

                    /** The part of this transaction amount that was for dental-related services. */
                    fun dental(dental: Dental?) = dental(JsonField.ofNullable(dental))

                    /** Alias for calling [Builder.dental] with `dental.orElse(null)`. */
                    fun dental(dental: Optional<Dental>) = dental(dental.getOrNull())

                    /**
                     * Sets [Builder.dental] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.dental] with a well-typed [Dental] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun dental(dental: JsonField<Dental>) = apply { this.dental = dental }

                    /** The original pre-authorized amount. */
                    fun original(original: Original?) = original(JsonField.ofNullable(original))

                    /** Alias for calling [Builder.original] with `original.orElse(null)`. */
                    fun original(original: Optional<Original>) = original(original.getOrNull())

                    /**
                     * Sets [Builder.original] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.original] with a well-typed [Original] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun original(original: JsonField<Original>) = apply { this.original = original }

                    /**
                     * The part of this transaction amount that was for healthcare prescriptions.
                     */
                    fun prescription(prescription: Prescription?) =
                        prescription(JsonField.ofNullable(prescription))

                    /**
                     * Alias for calling [Builder.prescription] with `prescription.orElse(null)`.
                     */
                    fun prescription(prescription: Optional<Prescription>) =
                        prescription(prescription.getOrNull())

                    /**
                     * Sets [Builder.prescription] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.prescription] with a well-typed
                     * [Prescription] value instead. This method is primarily for setting the field
                     * to an undocumented or not yet supported value.
                     */
                    fun prescription(prescription: JsonField<Prescription>) = apply {
                        this.prescription = prescription
                    }

                    /** The surcharge amount charged for this transaction by the merchant. */
                    fun surcharge(surcharge: Surcharge?) =
                        surcharge(JsonField.ofNullable(surcharge))

                    /** Alias for calling [Builder.surcharge] with `surcharge.orElse(null)`. */
                    fun surcharge(surcharge: Optional<Surcharge>) = surcharge(surcharge.getOrNull())

                    /**
                     * Sets [Builder.surcharge] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.surcharge] with a well-typed [Surcharge]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun surcharge(surcharge: JsonField<Surcharge>) = apply {
                        this.surcharge = surcharge
                    }

                    /**
                     * The total amount of a series of incremental authorizations, optionally
                     * provided.
                     */
                    fun totalCumulative(totalCumulative: TotalCumulative?) =
                        totalCumulative(JsonField.ofNullable(totalCumulative))

                    /**
                     * Alias for calling [Builder.totalCumulative] with
                     * `totalCumulative.orElse(null)`.
                     */
                    fun totalCumulative(totalCumulative: Optional<TotalCumulative>) =
                        totalCumulative(totalCumulative.getOrNull())

                    /**
                     * Sets [Builder.totalCumulative] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.totalCumulative] with a well-typed
                     * [TotalCumulative] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun totalCumulative(totalCumulative: JsonField<TotalCumulative>) = apply {
                        this.totalCumulative = totalCumulative
                    }

                    /** The total amount of healthcare-related additional amounts. */
                    fun totalHealthcare(totalHealthcare: TotalHealthcare?) =
                        totalHealthcare(JsonField.ofNullable(totalHealthcare))

                    /**
                     * Alias for calling [Builder.totalHealthcare] with
                     * `totalHealthcare.orElse(null)`.
                     */
                    fun totalHealthcare(totalHealthcare: Optional<TotalHealthcare>) =
                        totalHealthcare(totalHealthcare.getOrNull())

                    /**
                     * Sets [Builder.totalHealthcare] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.totalHealthcare] with a well-typed
                     * [TotalHealthcare] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun totalHealthcare(totalHealthcare: JsonField<TotalHealthcare>) = apply {
                        this.totalHealthcare = totalHealthcare
                    }

                    /**
                     * The part of this transaction amount that was for transit-related services.
                     */
                    fun transit(transit: Transit?) = transit(JsonField.ofNullable(transit))

                    /** Alias for calling [Builder.transit] with `transit.orElse(null)`. */
                    fun transit(transit: Optional<Transit>) = transit(transit.getOrNull())

                    /**
                     * Sets [Builder.transit] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.transit] with a well-typed [Transit] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun transit(transit: JsonField<Transit>) = apply { this.transit = transit }

                    /** An unknown additional amount. */
                    fun unknown(unknown: Unknown?) = unknown(JsonField.ofNullable(unknown))

                    /** Alias for calling [Builder.unknown] with `unknown.orElse(null)`. */
                    fun unknown(unknown: Optional<Unknown>) = unknown(unknown.getOrNull())

                    /**
                     * Sets [Builder.unknown] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.unknown] with a well-typed [Unknown] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun unknown(unknown: JsonField<Unknown>) = apply { this.unknown = unknown }

                    /** The part of this transaction amount that was for vision-related services. */
                    fun vision(vision: Vision?) = vision(JsonField.ofNullable(vision))

                    /** Alias for calling [Builder.vision] with `vision.orElse(null)`. */
                    fun vision(vision: Optional<Vision>) = vision(vision.getOrNull())

                    /**
                     * Sets [Builder.vision] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.vision] with a well-typed [Vision] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun vision(vision: JsonField<Vision>) = apply { this.vision = vision }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [AdditionalAmounts].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .clinic()
                     * .dental()
                     * .original()
                     * .prescription()
                     * .surcharge()
                     * .totalCumulative()
                     * .totalHealthcare()
                     * .transit()
                     * .unknown()
                     * .vision()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): AdditionalAmounts =
                        AdditionalAmounts(
                            checkRequired("clinic", clinic),
                            checkRequired("dental", dental),
                            checkRequired("original", original),
                            checkRequired("prescription", prescription),
                            checkRequired("surcharge", surcharge),
                            checkRequired("totalCumulative", totalCumulative),
                            checkRequired("totalHealthcare", totalHealthcare),
                            checkRequired("transit", transit),
                            checkRequired("unknown", unknown),
                            checkRequired("vision", vision),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): AdditionalAmounts = apply {
                    if (validated) {
                        return@apply
                    }

                    clinic().ifPresent { it.validate() }
                    dental().ifPresent { it.validate() }
                    original().ifPresent { it.validate() }
                    prescription().ifPresent { it.validate() }
                    surcharge().ifPresent { it.validate() }
                    totalCumulative().ifPresent { it.validate() }
                    totalHealthcare().ifPresent { it.validate() }
                    transit().ifPresent { it.validate() }
                    unknown().ifPresent { it.validate() }
                    vision().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (clinic.asKnown().getOrNull()?.validity() ?: 0) +
                        (dental.asKnown().getOrNull()?.validity() ?: 0) +
                        (original.asKnown().getOrNull()?.validity() ?: 0) +
                        (prescription.asKnown().getOrNull()?.validity() ?: 0) +
                        (surcharge.asKnown().getOrNull()?.validity() ?: 0) +
                        (totalCumulative.asKnown().getOrNull()?.validity() ?: 0) +
                        (totalHealthcare.asKnown().getOrNull()?.validity() ?: 0) +
                        (transit.asKnown().getOrNull()?.validity() ?: 0) +
                        (unknown.asKnown().getOrNull()?.validity() ?: 0) +
                        (vision.asKnown().getOrNull()?.validity() ?: 0)

                /** The part of this transaction amount that was for clinic-related services. */
                class Clinic
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Clinic].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Clinic]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(clinic: Clinic) = apply {
                            amount = clinic.amount
                            currency = clinic.currency
                            additionalProperties = clinic.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Clinic].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Clinic =
                            Clinic(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Clinic = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Clinic &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Clinic{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for dental-related services. */
                class Dental
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Dental].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Dental]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(dental: Dental) = apply {
                            amount = dental.amount
                            currency = dental.currency
                            additionalProperties = dental.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Dental].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Dental =
                            Dental(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Dental = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Dental &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Dental{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The original pre-authorized amount. */
                class Original
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Original].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Original]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(original: Original) = apply {
                            amount = original.amount
                            currency = original.currency
                            additionalProperties = original.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Original].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Original =
                            Original(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Original = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Original &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Original{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for healthcare prescriptions. */
                class Prescription
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Prescription].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Prescription]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(prescription: Prescription) = apply {
                            amount = prescription.amount
                            currency = prescription.currency
                            additionalProperties = prescription.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Prescription].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Prescription =
                            Prescription(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Prescription = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Prescription &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Prescription{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The surcharge amount charged for this transaction by the merchant. */
                class Surcharge
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Surcharge].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Surcharge]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(surcharge: Surcharge) = apply {
                            amount = surcharge.amount
                            currency = surcharge.currency
                            additionalProperties = surcharge.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Surcharge].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Surcharge =
                            Surcharge(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Surcharge = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Surcharge &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Surcharge{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /**
                 * The total amount of a series of incremental authorizations, optionally provided.
                 */
                class TotalCumulative
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [TotalCumulative].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [TotalCumulative]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(totalCumulative: TotalCumulative) = apply {
                            amount = totalCumulative.amount
                            currency = totalCumulative.currency
                            additionalProperties =
                                totalCumulative.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [TotalCumulative].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): TotalCumulative =
                            TotalCumulative(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): TotalCumulative = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is TotalCumulative &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "TotalCumulative{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The total amount of healthcare-related additional amounts. */
                class TotalHealthcare
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [TotalHealthcare].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [TotalHealthcare]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(totalHealthcare: TotalHealthcare) = apply {
                            amount = totalHealthcare.amount
                            currency = totalHealthcare.currency
                            additionalProperties =
                                totalHealthcare.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [TotalHealthcare].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): TotalHealthcare =
                            TotalHealthcare(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): TotalHealthcare = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is TotalHealthcare &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "TotalHealthcare{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for transit-related services. */
                class Transit
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Transit].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Transit]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(transit: Transit) = apply {
                            amount = transit.amount
                            currency = transit.currency
                            additionalProperties = transit.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Transit].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Transit =
                            Transit(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Transit = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Transit &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Transit{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** An unknown additional amount. */
                class Unknown
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Unknown].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Unknown]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(unknown: Unknown) = apply {
                            amount = unknown.amount
                            currency = unknown.currency
                            additionalProperties = unknown.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Unknown].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Unknown =
                            Unknown(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Unknown = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Unknown &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Unknown{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for vision-related services. */
                class Vision
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Vision].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Vision]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(vision: Vision) = apply {
                            amount = vision.amount
                            currency = vision.currency
                            additionalProperties = vision.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Vision].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Vision =
                            Vision(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Vision = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Vision &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Vision{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is AdditionalAmounts &&
                        clinic == other.clinic &&
                        dental == other.dental &&
                        original == other.original &&
                        prescription == other.prescription &&
                        surcharge == other.surcharge &&
                        totalCumulative == other.totalCumulative &&
                        totalHealthcare == other.totalHealthcare &&
                        transit == other.transit &&
                        unknown == other.unknown &&
                        vision == other.vision &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        clinic,
                        dental,
                        original,
                        prescription,
                        surcharge,
                        totalCumulative,
                        totalHealthcare,
                        transit,
                        unknown,
                        vision,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "AdditionalAmounts{clinic=$clinic, dental=$dental, original=$original, prescription=$prescription, surcharge=$surcharge, totalCumulative=$totalCumulative, totalHealthcare=$totalHealthcare, transit=$transit, unknown=$unknown, vision=$vision, additionalProperties=$additionalProperties}"
            }

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
             * currency.
             */
            class Currency @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** US Dollar (USD) */
                    @JvmField val USD = of("USD")

                    @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                }

                /** An enum containing [Currency]'s known values. */
                enum class Known {
                    /** US Dollar (USD) */
                    USD
                }

                /**
                 * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Currency] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** US Dollar (USD) */
                    USD,
                    /**
                     * An enum member indicating that [Currency] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        USD -> Value.USD
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        USD -> Known.USD
                        else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Currency = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Currency && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /**
             * The direction describes the direction the funds will move, either from the cardholder
             * to the merchant or from the merchant to the cardholder.
             */
            class Direction @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** A regular card authorization where funds are debited from the cardholder. */
                    @JvmField val SETTLEMENT = of("settlement")

                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    @JvmField val REFUND = of("refund")

                    @JvmStatic fun of(value: String) = Direction(JsonField.of(value))
                }

                /** An enum containing [Direction]'s known values. */
                enum class Known {
                    /** A regular card authorization where funds are debited from the cardholder. */
                    SETTLEMENT,
                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    REFUND,
                }

                /**
                 * An enum containing [Direction]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Direction] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** A regular card authorization where funds are debited from the cardholder. */
                    SETTLEMENT,
                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    REFUND,
                    /**
                     * An enum member indicating that [Direction] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        SETTLEMENT -> Value.SETTLEMENT
                        REFUND -> Value.REFUND
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        SETTLEMENT -> Known.SETTLEMENT
                        REFUND -> Known.REFUND
                        else -> throw IncreaseInvalidDataException("Unknown Direction: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Direction = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Direction && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** Fields specific to the `network`. */
            class NetworkDetails
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val category: JsonField<Category>,
                private val pulse: JsonField<Pulse>,
                private val visa: JsonField<Visa>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("category")
                    @ExcludeMissing
                    category: JsonField<Category> = JsonMissing.of(),
                    @JsonProperty("pulse")
                    @ExcludeMissing
                    pulse: JsonField<Pulse> = JsonMissing.of(),
                    @JsonProperty("visa") @ExcludeMissing visa: JsonField<Visa> = JsonMissing.of(),
                ) : this(category, pulse, visa, mutableMapOf())

                /**
                 * The payment network used to process this card authorization.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun category(): Category = category.getRequired("category")

                /**
                 * Fields specific to the `pulse` network.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun pulse(): Optional<Pulse> = pulse.getOptional("pulse")

                /**
                 * Fields specific to the `visa` network.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun visa(): Optional<Visa> = visa.getOptional("visa")

                /**
                 * Returns the raw JSON value of [category].
                 *
                 * Unlike [category], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("category")
                @ExcludeMissing
                fun _category(): JsonField<Category> = category

                /**
                 * Returns the raw JSON value of [pulse].
                 *
                 * Unlike [pulse], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("pulse") @ExcludeMissing fun _pulse(): JsonField<Pulse> = pulse

                /**
                 * Returns the raw JSON value of [visa].
                 *
                 * Unlike [visa], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("visa") @ExcludeMissing fun _visa(): JsonField<Visa> = visa

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [NetworkDetails].
                     *
                     * The following fields are required:
                     * ```java
                     * .category()
                     * .pulse()
                     * .visa()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [NetworkDetails]. */
                class Builder internal constructor() {

                    private var category: JsonField<Category>? = null
                    private var pulse: JsonField<Pulse>? = null
                    private var visa: JsonField<Visa>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(networkDetails: NetworkDetails) = apply {
                        category = networkDetails.category
                        pulse = networkDetails.pulse
                        visa = networkDetails.visa
                        additionalProperties = networkDetails.additionalProperties.toMutableMap()
                    }

                    /** The payment network used to process this card authorization. */
                    fun category(category: Category) = category(JsonField.of(category))

                    /**
                     * Sets [Builder.category] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.category] with a well-typed [Category] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun category(category: JsonField<Category>) = apply { this.category = category }

                    /** Fields specific to the `pulse` network. */
                    fun pulse(pulse: Pulse?) = pulse(JsonField.ofNullable(pulse))

                    /** Alias for calling [Builder.pulse] with `pulse.orElse(null)`. */
                    fun pulse(pulse: Optional<Pulse>) = pulse(pulse.getOrNull())

                    /**
                     * Sets [Builder.pulse] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.pulse] with a well-typed [Pulse] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun pulse(pulse: JsonField<Pulse>) = apply { this.pulse = pulse }

                    /** Fields specific to the `visa` network. */
                    fun visa(visa: Visa?) = visa(JsonField.ofNullable(visa))

                    /** Alias for calling [Builder.visa] with `visa.orElse(null)`. */
                    fun visa(visa: Optional<Visa>) = visa(visa.getOrNull())

                    /**
                     * Sets [Builder.visa] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.visa] with a well-typed [Visa] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun visa(visa: JsonField<Visa>) = apply { this.visa = visa }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [NetworkDetails].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .category()
                     * .pulse()
                     * .visa()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): NetworkDetails =
                        NetworkDetails(
                            checkRequired("category", category),
                            checkRequired("pulse", pulse),
                            checkRequired("visa", visa),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): NetworkDetails = apply {
                    if (validated) {
                        return@apply
                    }

                    category().validate()
                    pulse().ifPresent { it.validate() }
                    visa().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (category.asKnown().getOrNull()?.validity() ?: 0) +
                        (pulse.asKnown().getOrNull()?.validity() ?: 0) +
                        (visa.asKnown().getOrNull()?.validity() ?: 0)

                /** The payment network used to process this card authorization. */
                class Category
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** Visa */
                        @JvmField val VISA = of("visa")

                        /** Pulse */
                        @JvmField val PULSE = of("pulse")

                        @JvmStatic fun of(value: String) = Category(JsonField.of(value))
                    }

                    /** An enum containing [Category]'s known values. */
                    enum class Known {
                        /** Visa */
                        VISA,
                        /** Pulse */
                        PULSE,
                    }

                    /**
                     * An enum containing [Category]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Category] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** Visa */
                        VISA,
                        /** Pulse */
                        PULSE,
                        /**
                         * An enum member indicating that [Category] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            VISA -> Value.VISA
                            PULSE -> Value.PULSE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            VISA -> Known.VISA
                            PULSE -> Known.PULSE
                            else -> throw IncreaseInvalidDataException("Unknown Category: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Category = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Category && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** Fields specific to the `pulse` network. */
                class Pulse
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val additionalProperties: MutableMap<String, JsonValue>
                ) {

                    @JsonCreator private constructor() : this(mutableMapOf())

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /** Returns a mutable builder for constructing an instance of [Pulse]. */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Pulse]. */
                    class Builder internal constructor() {

                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(pulse: Pulse) = apply {
                            additionalProperties = pulse.additionalProperties.toMutableMap()
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Pulse].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         */
                        fun build(): Pulse = Pulse(additionalProperties.toMutableMap())
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Pulse = apply {
                        if (validated) {
                            return@apply
                        }

                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic internal fun validity(): Int = 0

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Pulse && additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy { Objects.hash(additionalProperties) }

                    override fun hashCode(): Int = hashCode

                    override fun toString() = "Pulse{additionalProperties=$additionalProperties}"
                }

                /** Fields specific to the `visa` network. */
                class Visa
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val electronicCommerceIndicator: JsonField<ElectronicCommerceIndicator>,
                    private val pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode>,
                    private val standInProcessingReason: JsonField<StandInProcessingReason>,
                    private val terminalEntryCapability: JsonField<TerminalEntryCapability>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("electronic_commerce_indicator")
                        @ExcludeMissing
                        electronicCommerceIndicator: JsonField<ElectronicCommerceIndicator> =
                            JsonMissing.of(),
                        @JsonProperty("point_of_service_entry_mode")
                        @ExcludeMissing
                        pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode> =
                            JsonMissing.of(),
                        @JsonProperty("stand_in_processing_reason")
                        @ExcludeMissing
                        standInProcessingReason: JsonField<StandInProcessingReason> =
                            JsonMissing.of(),
                        @JsonProperty("terminal_entry_capability")
                        @ExcludeMissing
                        terminalEntryCapability: JsonField<TerminalEntryCapability> =
                            JsonMissing.of(),
                    ) : this(
                        electronicCommerceIndicator,
                        pointOfServiceEntryMode,
                        standInProcessingReason,
                        terminalEntryCapability,
                        mutableMapOf(),
                    )

                    /**
                     * For electronic commerce transactions, this identifies the level of security
                     * used in obtaining the customer's payment credential. For mail or telephone
                     * order transactions, identifies the type of mail or telephone order.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun electronicCommerceIndicator(): Optional<ElectronicCommerceIndicator> =
                        electronicCommerceIndicator.getOptional("electronic_commerce_indicator")

                    /**
                     * The method used to enter the cardholder's primary account number and card
                     * expiration date.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun pointOfServiceEntryMode(): Optional<PointOfServiceEntryMode> =
                        pointOfServiceEntryMode.getOptional("point_of_service_entry_mode")

                    /**
                     * Only present when `actioner: network`. Describes why a card authorization was
                     * approved or declined by Visa through stand-in processing.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun standInProcessingReason(): Optional<StandInProcessingReason> =
                        standInProcessingReason.getOptional("stand_in_processing_reason")

                    /**
                     * The capability of the terminal being used to read the card. Shows whether a
                     * terminal can e.g., accept chip cards or if it only supports magnetic stripe
                     * reads. This reflects the highest capability of the terminal — for example, a
                     * terminal that supports both chip and magnetic stripe will be identified as
                     * chip-capable.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun terminalEntryCapability(): Optional<TerminalEntryCapability> =
                        terminalEntryCapability.getOptional("terminal_entry_capability")

                    /**
                     * Returns the raw JSON value of [electronicCommerceIndicator].
                     *
                     * Unlike [electronicCommerceIndicator], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("electronic_commerce_indicator")
                    @ExcludeMissing
                    fun _electronicCommerceIndicator(): JsonField<ElectronicCommerceIndicator> =
                        electronicCommerceIndicator

                    /**
                     * Returns the raw JSON value of [pointOfServiceEntryMode].
                     *
                     * Unlike [pointOfServiceEntryMode], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("point_of_service_entry_mode")
                    @ExcludeMissing
                    fun _pointOfServiceEntryMode(): JsonField<PointOfServiceEntryMode> =
                        pointOfServiceEntryMode

                    /**
                     * Returns the raw JSON value of [standInProcessingReason].
                     *
                     * Unlike [standInProcessingReason], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("stand_in_processing_reason")
                    @ExcludeMissing
                    fun _standInProcessingReason(): JsonField<StandInProcessingReason> =
                        standInProcessingReason

                    /**
                     * Returns the raw JSON value of [terminalEntryCapability].
                     *
                     * Unlike [terminalEntryCapability], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("terminal_entry_capability")
                    @ExcludeMissing
                    fun _terminalEntryCapability(): JsonField<TerminalEntryCapability> =
                        terminalEntryCapability

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Visa].
                         *
                         * The following fields are required:
                         * ```java
                         * .electronicCommerceIndicator()
                         * .pointOfServiceEntryMode()
                         * .standInProcessingReason()
                         * .terminalEntryCapability()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Visa]. */
                    class Builder internal constructor() {

                        private var electronicCommerceIndicator:
                            JsonField<ElectronicCommerceIndicator>? =
                            null
                        private var pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode>? =
                            null
                        private var standInProcessingReason: JsonField<StandInProcessingReason>? =
                            null
                        private var terminalEntryCapability: JsonField<TerminalEntryCapability>? =
                            null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(visa: Visa) = apply {
                            electronicCommerceIndicator = visa.electronicCommerceIndicator
                            pointOfServiceEntryMode = visa.pointOfServiceEntryMode
                            standInProcessingReason = visa.standInProcessingReason
                            terminalEntryCapability = visa.terminalEntryCapability
                            additionalProperties = visa.additionalProperties.toMutableMap()
                        }

                        /**
                         * For electronic commerce transactions, this identifies the level of
                         * security used in obtaining the customer's payment credential. For mail or
                         * telephone order transactions, identifies the type of mail or telephone
                         * order.
                         */
                        fun electronicCommerceIndicator(
                            electronicCommerceIndicator: ElectronicCommerceIndicator?
                        ) =
                            electronicCommerceIndicator(
                                JsonField.ofNullable(electronicCommerceIndicator)
                            )

                        /**
                         * Alias for calling [Builder.electronicCommerceIndicator] with
                         * `electronicCommerceIndicator.orElse(null)`.
                         */
                        fun electronicCommerceIndicator(
                            electronicCommerceIndicator: Optional<ElectronicCommerceIndicator>
                        ) = electronicCommerceIndicator(electronicCommerceIndicator.getOrNull())

                        /**
                         * Sets [Builder.electronicCommerceIndicator] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.electronicCommerceIndicator] with a
                         * well-typed [ElectronicCommerceIndicator] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun electronicCommerceIndicator(
                            electronicCommerceIndicator: JsonField<ElectronicCommerceIndicator>
                        ) = apply { this.electronicCommerceIndicator = electronicCommerceIndicator }

                        /**
                         * The method used to enter the cardholder's primary account number and card
                         * expiration date.
                         */
                        fun pointOfServiceEntryMode(
                            pointOfServiceEntryMode: PointOfServiceEntryMode?
                        ) = pointOfServiceEntryMode(JsonField.ofNullable(pointOfServiceEntryMode))

                        /**
                         * Alias for calling [Builder.pointOfServiceEntryMode] with
                         * `pointOfServiceEntryMode.orElse(null)`.
                         */
                        fun pointOfServiceEntryMode(
                            pointOfServiceEntryMode: Optional<PointOfServiceEntryMode>
                        ) = pointOfServiceEntryMode(pointOfServiceEntryMode.getOrNull())

                        /**
                         * Sets [Builder.pointOfServiceEntryMode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.pointOfServiceEntryMode] with a
                         * well-typed [PointOfServiceEntryMode] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun pointOfServiceEntryMode(
                            pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode>
                        ) = apply { this.pointOfServiceEntryMode = pointOfServiceEntryMode }

                        /**
                         * Only present when `actioner: network`. Describes why a card authorization
                         * was approved or declined by Visa through stand-in processing.
                         */
                        fun standInProcessingReason(
                            standInProcessingReason: StandInProcessingReason?
                        ) = standInProcessingReason(JsonField.ofNullable(standInProcessingReason))

                        /**
                         * Alias for calling [Builder.standInProcessingReason] with
                         * `standInProcessingReason.orElse(null)`.
                         */
                        fun standInProcessingReason(
                            standInProcessingReason: Optional<StandInProcessingReason>
                        ) = standInProcessingReason(standInProcessingReason.getOrNull())

                        /**
                         * Sets [Builder.standInProcessingReason] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.standInProcessingReason] with a
                         * well-typed [StandInProcessingReason] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun standInProcessingReason(
                            standInProcessingReason: JsonField<StandInProcessingReason>
                        ) = apply { this.standInProcessingReason = standInProcessingReason }

                        /**
                         * The capability of the terminal being used to read the card. Shows whether
                         * a terminal can e.g., accept chip cards or if it only supports magnetic
                         * stripe reads. This reflects the highest capability of the terminal — for
                         * example, a terminal that supports both chip and magnetic stripe will be
                         * identified as chip-capable.
                         */
                        fun terminalEntryCapability(
                            terminalEntryCapability: TerminalEntryCapability?
                        ) = terminalEntryCapability(JsonField.ofNullable(terminalEntryCapability))

                        /**
                         * Alias for calling [Builder.terminalEntryCapability] with
                         * `terminalEntryCapability.orElse(null)`.
                         */
                        fun terminalEntryCapability(
                            terminalEntryCapability: Optional<TerminalEntryCapability>
                        ) = terminalEntryCapability(terminalEntryCapability.getOrNull())

                        /**
                         * Sets [Builder.terminalEntryCapability] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.terminalEntryCapability] with a
                         * well-typed [TerminalEntryCapability] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun terminalEntryCapability(
                            terminalEntryCapability: JsonField<TerminalEntryCapability>
                        ) = apply { this.terminalEntryCapability = terminalEntryCapability }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Visa].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .electronicCommerceIndicator()
                         * .pointOfServiceEntryMode()
                         * .standInProcessingReason()
                         * .terminalEntryCapability()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Visa =
                            Visa(
                                checkRequired(
                                    "electronicCommerceIndicator",
                                    electronicCommerceIndicator,
                                ),
                                checkRequired("pointOfServiceEntryMode", pointOfServiceEntryMode),
                                checkRequired("standInProcessingReason", standInProcessingReason),
                                checkRequired("terminalEntryCapability", terminalEntryCapability),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Visa = apply {
                        if (validated) {
                            return@apply
                        }

                        electronicCommerceIndicator().ifPresent { it.validate() }
                        pointOfServiceEntryMode().ifPresent { it.validate() }
                        standInProcessingReason().ifPresent { it.validate() }
                        terminalEntryCapability().ifPresent { it.validate() }
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (electronicCommerceIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                            (pointOfServiceEntryMode.asKnown().getOrNull()?.validity() ?: 0) +
                            (standInProcessingReason.asKnown().getOrNull()?.validity() ?: 0) +
                            (terminalEntryCapability.asKnown().getOrNull()?.validity() ?: 0)

                    /**
                     * For electronic commerce transactions, this identifies the level of security
                     * used in obtaining the customer's payment credential. For mail or telephone
                     * order transactions, identifies the type of mail or telephone order.
                     */
                    class ElectronicCommerceIndicator
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /**
                             * Single transaction of a mail/phone order: Use to indicate that the
                             * transaction is a mail/phone order purchase, not a recurring
                             * transaction or installment payment. For domestic transactions in the
                             * US region, this value may also indicate one bill payment transaction
                             * in the card-present or card-absent environments.
                             */
                            @JvmField val MAIL_PHONE_ORDER = of("mail_phone_order")

                            /**
                             * Recurring transaction: Payment indicator used to indicate a recurring
                             * transaction that originates from an acquirer in the US region.
                             */
                            @JvmField val RECURRING = of("recurring")

                            /**
                             * Installment payment: Payment indicator used to indicate one purchase
                             * of goods or services that is billed to the account in multiple
                             * charges over a period of time agreed upon by the cardholder and
                             * merchant from transactions that originate from an acquirer in the US
                             * region.
                             */
                            @JvmField val INSTALLMENT = of("installment")

                            /**
                             * Unknown classification: other mail order: Use to indicate that the
                             * type of mail/telephone order is unknown.
                             */
                            @JvmField val UNKNOWN_MAIL_PHONE_ORDER = of("unknown_mail_phone_order")

                            /**
                             * Secure electronic commerce transaction: Use to indicate that the
                             * electronic commerce transaction has been authenticated using e.g.,
                             * 3-D Secure
                             */
                            @JvmField
                            val SECURE_ELECTRONIC_COMMERCE = of("secure_electronic_commerce")

                            /**
                             * Non-authenticated security transaction at a 3-D Secure-capable
                             * merchant, and merchant attempted to authenticate the cardholder using
                             * 3-D Secure: Use to identify an electronic commerce transaction where
                             * the merchant attempted to authenticate the cardholder using 3-D
                             * Secure, but was unable to complete the authentication because the
                             * issuer or cardholder does not participate in the 3-D Secure program.
                             */
                            @JvmField
                            val NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT =
                                of("non_authenticated_security_transaction_at_3ds_capable_merchant")

                            /**
                             * Non-authenticated security transaction: Use to identify an electronic
                             * commerce transaction that uses data encryption for security however,
                             * cardholder authentication is not performed using 3-D Secure.
                             */
                            @JvmField
                            val NON_AUTHENTICATED_SECURITY_TRANSACTION =
                                of("non_authenticated_security_transaction")

                            /**
                             * Non-secure transaction: Use to identify an electronic commerce
                             * transaction that has no data protection.
                             */
                            @JvmField val NON_SECURE_TRANSACTION = of("non_secure_transaction")

                            @JvmStatic
                            fun of(value: String) = ElectronicCommerceIndicator(JsonField.of(value))
                        }

                        /** An enum containing [ElectronicCommerceIndicator]'s known values. */
                        enum class Known {
                            /**
                             * Single transaction of a mail/phone order: Use to indicate that the
                             * transaction is a mail/phone order purchase, not a recurring
                             * transaction or installment payment. For domestic transactions in the
                             * US region, this value may also indicate one bill payment transaction
                             * in the card-present or card-absent environments.
                             */
                            MAIL_PHONE_ORDER,
                            /**
                             * Recurring transaction: Payment indicator used to indicate a recurring
                             * transaction that originates from an acquirer in the US region.
                             */
                            RECURRING,
                            /**
                             * Installment payment: Payment indicator used to indicate one purchase
                             * of goods or services that is billed to the account in multiple
                             * charges over a period of time agreed upon by the cardholder and
                             * merchant from transactions that originate from an acquirer in the US
                             * region.
                             */
                            INSTALLMENT,
                            /**
                             * Unknown classification: other mail order: Use to indicate that the
                             * type of mail/telephone order is unknown.
                             */
                            UNKNOWN_MAIL_PHONE_ORDER,
                            /**
                             * Secure electronic commerce transaction: Use to indicate that the
                             * electronic commerce transaction has been authenticated using e.g.,
                             * 3-D Secure
                             */
                            SECURE_ELECTRONIC_COMMERCE,
                            /**
                             * Non-authenticated security transaction at a 3-D Secure-capable
                             * merchant, and merchant attempted to authenticate the cardholder using
                             * 3-D Secure: Use to identify an electronic commerce transaction where
                             * the merchant attempted to authenticate the cardholder using 3-D
                             * Secure, but was unable to complete the authentication because the
                             * issuer or cardholder does not participate in the 3-D Secure program.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT,
                            /**
                             * Non-authenticated security transaction: Use to identify an electronic
                             * commerce transaction that uses data encryption for security however,
                             * cardholder authentication is not performed using 3-D Secure.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION,
                            /**
                             * Non-secure transaction: Use to identify an electronic commerce
                             * transaction that has no data protection.
                             */
                            NON_SECURE_TRANSACTION,
                        }

                        /**
                         * An enum containing [ElectronicCommerceIndicator]'s known values, as well
                         * as an [_UNKNOWN] member.
                         *
                         * An instance of [ElectronicCommerceIndicator] can contain an unknown value
                         * in a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /**
                             * Single transaction of a mail/phone order: Use to indicate that the
                             * transaction is a mail/phone order purchase, not a recurring
                             * transaction or installment payment. For domestic transactions in the
                             * US region, this value may also indicate one bill payment transaction
                             * in the card-present or card-absent environments.
                             */
                            MAIL_PHONE_ORDER,
                            /**
                             * Recurring transaction: Payment indicator used to indicate a recurring
                             * transaction that originates from an acquirer in the US region.
                             */
                            RECURRING,
                            /**
                             * Installment payment: Payment indicator used to indicate one purchase
                             * of goods or services that is billed to the account in multiple
                             * charges over a period of time agreed upon by the cardholder and
                             * merchant from transactions that originate from an acquirer in the US
                             * region.
                             */
                            INSTALLMENT,
                            /**
                             * Unknown classification: other mail order: Use to indicate that the
                             * type of mail/telephone order is unknown.
                             */
                            UNKNOWN_MAIL_PHONE_ORDER,
                            /**
                             * Secure electronic commerce transaction: Use to indicate that the
                             * electronic commerce transaction has been authenticated using e.g.,
                             * 3-D Secure
                             */
                            SECURE_ELECTRONIC_COMMERCE,
                            /**
                             * Non-authenticated security transaction at a 3-D Secure-capable
                             * merchant, and merchant attempted to authenticate the cardholder using
                             * 3-D Secure: Use to identify an electronic commerce transaction where
                             * the merchant attempted to authenticate the cardholder using 3-D
                             * Secure, but was unable to complete the authentication because the
                             * issuer or cardholder does not participate in the 3-D Secure program.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT,
                            /**
                             * Non-authenticated security transaction: Use to identify an electronic
                             * commerce transaction that uses data encryption for security however,
                             * cardholder authentication is not performed using 3-D Secure.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION,
                            /**
                             * Non-secure transaction: Use to identify an electronic commerce
                             * transaction that has no data protection.
                             */
                            NON_SECURE_TRANSACTION,
                            /**
                             * An enum member indicating that [ElectronicCommerceIndicator] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                MAIL_PHONE_ORDER -> Value.MAIL_PHONE_ORDER
                                RECURRING -> Value.RECURRING
                                INSTALLMENT -> Value.INSTALLMENT
                                UNKNOWN_MAIL_PHONE_ORDER -> Value.UNKNOWN_MAIL_PHONE_ORDER
                                SECURE_ELECTRONIC_COMMERCE -> Value.SECURE_ELECTRONIC_COMMERCE
                                NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT ->
                                    Value
                                        .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT
                                NON_AUTHENTICATED_SECURITY_TRANSACTION ->
                                    Value.NON_AUTHENTICATED_SECURITY_TRANSACTION
                                NON_SECURE_TRANSACTION -> Value.NON_SECURE_TRANSACTION
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                MAIL_PHONE_ORDER -> Known.MAIL_PHONE_ORDER
                                RECURRING -> Known.RECURRING
                                INSTALLMENT -> Known.INSTALLMENT
                                UNKNOWN_MAIL_PHONE_ORDER -> Known.UNKNOWN_MAIL_PHONE_ORDER
                                SECURE_ELECTRONIC_COMMERCE -> Known.SECURE_ELECTRONIC_COMMERCE
                                NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT ->
                                    Known
                                        .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT
                                NON_AUTHENTICATED_SECURITY_TRANSACTION ->
                                    Known.NON_AUTHENTICATED_SECURITY_TRANSACTION
                                NON_SECURE_TRANSACTION -> Known.NON_SECURE_TRANSACTION
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown ElectronicCommerceIndicator: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): ElectronicCommerceIndicator = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is ElectronicCommerceIndicator && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * The method used to enter the cardholder's primary account number and card
                     * expiration date.
                     */
                    class PointOfServiceEntryMode
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Unknown */
                            @JvmField val UNKNOWN = of("unknown")

                            /** Manual key entry */
                            @JvmField val MANUAL = of("manual")

                            /** Magnetic stripe read, without card verification value */
                            @JvmField val MAGNETIC_STRIPE_NO_CVV = of("magnetic_stripe_no_cvv")

                            /** Optical code */
                            @JvmField val OPTICAL_CODE = of("optical_code")

                            /** Contact chip card */
                            @JvmField val INTEGRATED_CIRCUIT_CARD = of("integrated_circuit_card")

                            /** Contactless read of chip card */
                            @JvmField val CONTACTLESS = of("contactless")

                            /**
                             * Transaction initiated using a credential that has previously been
                             * stored on file
                             */
                            @JvmField val CREDENTIAL_ON_FILE = of("credential_on_file")

                            /** Magnetic stripe read */
                            @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe")

                            /** Contactless read of magnetic stripe data */
                            @JvmField
                            val CONTACTLESS_MAGNETIC_STRIPE = of("contactless_magnetic_stripe")

                            /** Contact chip card, without card verification value */
                            @JvmField
                            val INTEGRATED_CIRCUIT_CARD_NO_CVV =
                                of("integrated_circuit_card_no_cvv")

                            @JvmStatic
                            fun of(value: String) = PointOfServiceEntryMode(JsonField.of(value))
                        }

                        /** An enum containing [PointOfServiceEntryMode]'s known values. */
                        enum class Known {
                            /** Unknown */
                            UNKNOWN,
                            /** Manual key entry */
                            MANUAL,
                            /** Magnetic stripe read, without card verification value */
                            MAGNETIC_STRIPE_NO_CVV,
                            /** Optical code */
                            OPTICAL_CODE,
                            /** Contact chip card */
                            INTEGRATED_CIRCUIT_CARD,
                            /** Contactless read of chip card */
                            CONTACTLESS,
                            /**
                             * Transaction initiated using a credential that has previously been
                             * stored on file
                             */
                            CREDENTIAL_ON_FILE,
                            /** Magnetic stripe read */
                            MAGNETIC_STRIPE,
                            /** Contactless read of magnetic stripe data */
                            CONTACTLESS_MAGNETIC_STRIPE,
                            /** Contact chip card, without card verification value */
                            INTEGRATED_CIRCUIT_CARD_NO_CVV,
                        }

                        /**
                         * An enum containing [PointOfServiceEntryMode]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [PointOfServiceEntryMode] can contain an unknown value in
                         * a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Unknown */
                            UNKNOWN,
                            /** Manual key entry */
                            MANUAL,
                            /** Magnetic stripe read, without card verification value */
                            MAGNETIC_STRIPE_NO_CVV,
                            /** Optical code */
                            OPTICAL_CODE,
                            /** Contact chip card */
                            INTEGRATED_CIRCUIT_CARD,
                            /** Contactless read of chip card */
                            CONTACTLESS,
                            /**
                             * Transaction initiated using a credential that has previously been
                             * stored on file
                             */
                            CREDENTIAL_ON_FILE,
                            /** Magnetic stripe read */
                            MAGNETIC_STRIPE,
                            /** Contactless read of magnetic stripe data */
                            CONTACTLESS_MAGNETIC_STRIPE,
                            /** Contact chip card, without card verification value */
                            INTEGRATED_CIRCUIT_CARD_NO_CVV,
                            /**
                             * An enum member indicating that [PointOfServiceEntryMode] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                UNKNOWN -> Value.UNKNOWN
                                MANUAL -> Value.MANUAL
                                MAGNETIC_STRIPE_NO_CVV -> Value.MAGNETIC_STRIPE_NO_CVV
                                OPTICAL_CODE -> Value.OPTICAL_CODE
                                INTEGRATED_CIRCUIT_CARD -> Value.INTEGRATED_CIRCUIT_CARD
                                CONTACTLESS -> Value.CONTACTLESS
                                CREDENTIAL_ON_FILE -> Value.CREDENTIAL_ON_FILE
                                MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE
                                CONTACTLESS_MAGNETIC_STRIPE -> Value.CONTACTLESS_MAGNETIC_STRIPE
                                INTEGRATED_CIRCUIT_CARD_NO_CVV ->
                                    Value.INTEGRATED_CIRCUIT_CARD_NO_CVV
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                UNKNOWN -> Known.UNKNOWN
                                MANUAL -> Known.MANUAL
                                MAGNETIC_STRIPE_NO_CVV -> Known.MAGNETIC_STRIPE_NO_CVV
                                OPTICAL_CODE -> Known.OPTICAL_CODE
                                INTEGRATED_CIRCUIT_CARD -> Known.INTEGRATED_CIRCUIT_CARD
                                CONTACTLESS -> Known.CONTACTLESS
                                CREDENTIAL_ON_FILE -> Known.CREDENTIAL_ON_FILE
                                MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE
                                CONTACTLESS_MAGNETIC_STRIPE -> Known.CONTACTLESS_MAGNETIC_STRIPE
                                INTEGRATED_CIRCUIT_CARD_NO_CVV ->
                                    Known.INTEGRATED_CIRCUIT_CARD_NO_CVV
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown PointOfServiceEntryMode: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): PointOfServiceEntryMode = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is PointOfServiceEntryMode && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * Only present when `actioner: network`. Describes why a card authorization was
                     * approved or declined by Visa through stand-in processing.
                     */
                    class StandInProcessingReason
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Increase failed to process the authorization in a timely manner. */
                            @JvmField val ISSUER_ERROR = of("issuer_error")

                            /** The physical card read had an invalid CVV or dCVV. */
                            @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card")

                            /**
                             * The card's authorization request cryptogram was invalid. The
                             * cryptogram can be from a physical card or a Digital Wallet Token
                             * purchase.
                             */
                            @JvmField val INVALID_CRYPTOGRAM = of("invalid_cryptogram")

                            /** The 3DS cardholder authentication verification value was invalid. */
                            @JvmField
                            val INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE =
                                of("invalid_cardholder_authentication_verification_value")

                            /**
                             * An internal Visa error occurred. Visa uses this reason code for
                             * certain expected occurrences as well, such as Application Transaction
                             * Counter (ATC) replays.
                             */
                            @JvmField val INTERNAL_VISA_ERROR = of("internal_visa_error")

                            /**
                             * The merchant has enabled Visa's Transaction Advisory Service and
                             * requires further authentication to perform the transaction. In
                             * practice this is often utilized at fuel pumps to tell the cardholder
                             * to see the cashier.
                             */
                            @JvmField
                            val MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED =
                                of("merchant_transaction_advisory_service_authentication_required")

                            /**
                             * The transaction was blocked by Visa's Payment Fraud Disruption
                             * service due to fraudulent Acquirer behavior, such as card testing.
                             */
                            @JvmField
                            val PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK =
                                of("payment_fraud_disruption_acquirer_block")

                            /** An unspecific reason for stand-in processing. */
                            @JvmField val OTHER = of("other")

                            @JvmStatic
                            fun of(value: String) = StandInProcessingReason(JsonField.of(value))
                        }

                        /** An enum containing [StandInProcessingReason]'s known values. */
                        enum class Known {
                            /** Increase failed to process the authorization in a timely manner. */
                            ISSUER_ERROR,
                            /** The physical card read had an invalid CVV or dCVV. */
                            INVALID_PHYSICAL_CARD,
                            /**
                             * The card's authorization request cryptogram was invalid. The
                             * cryptogram can be from a physical card or a Digital Wallet Token
                             * purchase.
                             */
                            INVALID_CRYPTOGRAM,
                            /** The 3DS cardholder authentication verification value was invalid. */
                            INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE,
                            /**
                             * An internal Visa error occurred. Visa uses this reason code for
                             * certain expected occurrences as well, such as Application Transaction
                             * Counter (ATC) replays.
                             */
                            INTERNAL_VISA_ERROR,
                            /**
                             * The merchant has enabled Visa's Transaction Advisory Service and
                             * requires further authentication to perform the transaction. In
                             * practice this is often utilized at fuel pumps to tell the cardholder
                             * to see the cashier.
                             */
                            MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED,
                            /**
                             * The transaction was blocked by Visa's Payment Fraud Disruption
                             * service due to fraudulent Acquirer behavior, such as card testing.
                             */
                            PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK,
                            /** An unspecific reason for stand-in processing. */
                            OTHER,
                        }

                        /**
                         * An enum containing [StandInProcessingReason]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [StandInProcessingReason] can contain an unknown value in
                         * a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Increase failed to process the authorization in a timely manner. */
                            ISSUER_ERROR,
                            /** The physical card read had an invalid CVV or dCVV. */
                            INVALID_PHYSICAL_CARD,
                            /**
                             * The card's authorization request cryptogram was invalid. The
                             * cryptogram can be from a physical card or a Digital Wallet Token
                             * purchase.
                             */
                            INVALID_CRYPTOGRAM,
                            /** The 3DS cardholder authentication verification value was invalid. */
                            INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE,
                            /**
                             * An internal Visa error occurred. Visa uses this reason code for
                             * certain expected occurrences as well, such as Application Transaction
                             * Counter (ATC) replays.
                             */
                            INTERNAL_VISA_ERROR,
                            /**
                             * The merchant has enabled Visa's Transaction Advisory Service and
                             * requires further authentication to perform the transaction. In
                             * practice this is often utilized at fuel pumps to tell the cardholder
                             * to see the cashier.
                             */
                            MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED,
                            /**
                             * The transaction was blocked by Visa's Payment Fraud Disruption
                             * service due to fraudulent Acquirer behavior, such as card testing.
                             */
                            PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK,
                            /** An unspecific reason for stand-in processing. */
                            OTHER,
                            /**
                             * An enum member indicating that [StandInProcessingReason] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                ISSUER_ERROR -> Value.ISSUER_ERROR
                                INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD
                                INVALID_CRYPTOGRAM -> Value.INVALID_CRYPTOGRAM
                                INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE ->
                                    Value.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE
                                INTERNAL_VISA_ERROR -> Value.INTERNAL_VISA_ERROR
                                MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED ->
                                    Value
                                        .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED
                                PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK ->
                                    Value.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK
                                OTHER -> Value.OTHER
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                ISSUER_ERROR -> Known.ISSUER_ERROR
                                INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD
                                INVALID_CRYPTOGRAM -> Known.INVALID_CRYPTOGRAM
                                INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE ->
                                    Known.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE
                                INTERNAL_VISA_ERROR -> Known.INTERNAL_VISA_ERROR
                                MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED ->
                                    Known
                                        .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED
                                PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK ->
                                    Known.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK
                                OTHER -> Known.OTHER
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown StandInProcessingReason: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): StandInProcessingReason = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is StandInProcessingReason && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * The capability of the terminal being used to read the card. Shows whether a
                     * terminal can e.g., accept chip cards or if it only supports magnetic stripe
                     * reads. This reflects the highest capability of the terminal — for example, a
                     * terminal that supports both chip and magnetic stripe will be identified as
                     * chip-capable.
                     */
                    class TerminalEntryCapability
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Unknown */
                            @JvmField val UNKNOWN = of("unknown")

                            /** No terminal was used for this transaction. */
                            @JvmField val TERMINAL_NOT_USED = of("terminal_not_used")

                            /**
                             * The terminal can only read magnetic stripes and does not have chip or
                             * contactless reading capability.
                             */
                            @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe")

                            /** The terminal can only read barcodes. */
                            @JvmField val BARCODE = of("barcode")

                            /**
                             * The terminal can only read cards via Optical Character Recognition.
                             */
                            @JvmField
                            val OPTICAL_CHARACTER_RECOGNITION = of("optical_character_recognition")

                            /**
                             * The terminal supports contact chip cards and can also read the
                             * magnetic stripe. If contact chip is supported, this value is used
                             * regardless of whether contactless is also supported.
                             */
                            @JvmField val CHIP_OR_CONTACTLESS = of("chip_or_contactless")

                            /**
                             * The terminal supports contactless reads but does not support contact
                             * chip. Only used when the terminal lacks contact chip capability.
                             */
                            @JvmField val CONTACTLESS_ONLY = of("contactless_only")

                            /** The terminal has no card reading capability. */
                            @JvmField val NO_CAPABILITY = of("no_capability")

                            @JvmStatic
                            fun of(value: String) = TerminalEntryCapability(JsonField.of(value))
                        }

                        /** An enum containing [TerminalEntryCapability]'s known values. */
                        enum class Known {
                            /** Unknown */
                            UNKNOWN,
                            /** No terminal was used for this transaction. */
                            TERMINAL_NOT_USED,
                            /**
                             * The terminal can only read magnetic stripes and does not have chip or
                             * contactless reading capability.
                             */
                            MAGNETIC_STRIPE,
                            /** The terminal can only read barcodes. */
                            BARCODE,
                            /**
                             * The terminal can only read cards via Optical Character Recognition.
                             */
                            OPTICAL_CHARACTER_RECOGNITION,
                            /**
                             * The terminal supports contact chip cards and can also read the
                             * magnetic stripe. If contact chip is supported, this value is used
                             * regardless of whether contactless is also supported.
                             */
                            CHIP_OR_CONTACTLESS,
                            /**
                             * The terminal supports contactless reads but does not support contact
                             * chip. Only used when the terminal lacks contact chip capability.
                             */
                            CONTACTLESS_ONLY,
                            /** The terminal has no card reading capability. */
                            NO_CAPABILITY,
                        }

                        /**
                         * An enum containing [TerminalEntryCapability]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [TerminalEntryCapability] can contain an unknown value in
                         * a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Unknown */
                            UNKNOWN,
                            /** No terminal was used for this transaction. */
                            TERMINAL_NOT_USED,
                            /**
                             * The terminal can only read magnetic stripes and does not have chip or
                             * contactless reading capability.
                             */
                            MAGNETIC_STRIPE,
                            /** The terminal can only read barcodes. */
                            BARCODE,
                            /**
                             * The terminal can only read cards via Optical Character Recognition.
                             */
                            OPTICAL_CHARACTER_RECOGNITION,
                            /**
                             * The terminal supports contact chip cards and can also read the
                             * magnetic stripe. If contact chip is supported, this value is used
                             * regardless of whether contactless is also supported.
                             */
                            CHIP_OR_CONTACTLESS,
                            /**
                             * The terminal supports contactless reads but does not support contact
                             * chip. Only used when the terminal lacks contact chip capability.
                             */
                            CONTACTLESS_ONLY,
                            /** The terminal has no card reading capability. */
                            NO_CAPABILITY,
                            /**
                             * An enum member indicating that [TerminalEntryCapability] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                UNKNOWN -> Value.UNKNOWN
                                TERMINAL_NOT_USED -> Value.TERMINAL_NOT_USED
                                MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE
                                BARCODE -> Value.BARCODE
                                OPTICAL_CHARACTER_RECOGNITION -> Value.OPTICAL_CHARACTER_RECOGNITION
                                CHIP_OR_CONTACTLESS -> Value.CHIP_OR_CONTACTLESS
                                CONTACTLESS_ONLY -> Value.CONTACTLESS_ONLY
                                NO_CAPABILITY -> Value.NO_CAPABILITY
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                UNKNOWN -> Known.UNKNOWN
                                TERMINAL_NOT_USED -> Known.TERMINAL_NOT_USED
                                MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE
                                BARCODE -> Known.BARCODE
                                OPTICAL_CHARACTER_RECOGNITION -> Known.OPTICAL_CHARACTER_RECOGNITION
                                CHIP_OR_CONTACTLESS -> Known.CHIP_OR_CONTACTLESS
                                CONTACTLESS_ONLY -> Known.CONTACTLESS_ONLY
                                NO_CAPABILITY -> Known.NO_CAPABILITY
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown TerminalEntryCapability: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): TerminalEntryCapability = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is TerminalEntryCapability && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Visa &&
                            electronicCommerceIndicator == other.electronicCommerceIndicator &&
                            pointOfServiceEntryMode == other.pointOfServiceEntryMode &&
                            standInProcessingReason == other.standInProcessingReason &&
                            terminalEntryCapability == other.terminalEntryCapability &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            electronicCommerceIndicator,
                            pointOfServiceEntryMode,
                            standInProcessingReason,
                            terminalEntryCapability,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Visa{electronicCommerceIndicator=$electronicCommerceIndicator, pointOfServiceEntryMode=$pointOfServiceEntryMode, standInProcessingReason=$standInProcessingReason, terminalEntryCapability=$terminalEntryCapability, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is NetworkDetails &&
                        category == other.category &&
                        pulse == other.pulse &&
                        visa == other.visa &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(category, pulse, visa, additionalProperties)
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "NetworkDetails{category=$category, pulse=$pulse, visa=$visa, additionalProperties=$additionalProperties}"
            }

            /** Network-specific identifiers for a specific request or transaction. */
            class NetworkIdentifiers
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val authorizationIdentificationResponse: JsonField<String>,
                private val retrievalReferenceNumber: JsonField<String>,
                private val traceNumber: JsonField<String>,
                private val transactionId: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("authorization_identification_response")
                    @ExcludeMissing
                    authorizationIdentificationResponse: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("retrieval_reference_number")
                    @ExcludeMissing
                    retrievalReferenceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("trace_number")
                    @ExcludeMissing
                    traceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("transaction_id")
                    @ExcludeMissing
                    transactionId: JsonField<String> = JsonMissing.of(),
                ) : this(
                    authorizationIdentificationResponse,
                    retrievalReferenceNumber,
                    traceNumber,
                    transactionId,
                    mutableMapOf(),
                )

                /**
                 * The randomly generated 6-character Authorization Identification Response code
                 * sent back to the acquirer in an approved response.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun authorizationIdentificationResponse(): Optional<String> =
                    authorizationIdentificationResponse.getOptional(
                        "authorization_identification_response"
                    )

                /**
                 * A life-cycle identifier used across e.g., an authorization and a reversal.
                 * Expected to be unique per acquirer within a window of time. For some card
                 * networks the retrieval reference number includes the trace counter.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun retrievalReferenceNumber(): Optional<String> =
                    retrievalReferenceNumber.getOptional("retrieval_reference_number")

                /**
                 * A counter used to verify an individual authorization. Expected to be unique per
                 * acquirer within a window of time.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun traceNumber(): Optional<String> = traceNumber.getOptional("trace_number")

                /**
                 * A globally unique transaction identifier provided by the card network, used
                 * across multiple life-cycle requests.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun transactionId(): Optional<String> = transactionId.getOptional("transaction_id")

                /**
                 * Returns the raw JSON value of [authorizationIdentificationResponse].
                 *
                 * Unlike [authorizationIdentificationResponse], this method doesn't throw if the
                 * JSON field has an unexpected type.
                 */
                @JsonProperty("authorization_identification_response")
                @ExcludeMissing
                fun _authorizationIdentificationResponse(): JsonField<String> =
                    authorizationIdentificationResponse

                /**
                 * Returns the raw JSON value of [retrievalReferenceNumber].
                 *
                 * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field
                 * has an unexpected type.
                 */
                @JsonProperty("retrieval_reference_number")
                @ExcludeMissing
                fun _retrievalReferenceNumber(): JsonField<String> = retrievalReferenceNumber

                /**
                 * Returns the raw JSON value of [traceNumber].
                 *
                 * Unlike [traceNumber], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("trace_number")
                @ExcludeMissing
                fun _traceNumber(): JsonField<String> = traceNumber

                /**
                 * Returns the raw JSON value of [transactionId].
                 *
                 * Unlike [transactionId], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("transaction_id")
                @ExcludeMissing
                fun _transactionId(): JsonField<String> = transactionId

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of
                     * [NetworkIdentifiers].
                     *
                     * The following fields are required:
                     * ```java
                     * .authorizationIdentificationResponse()
                     * .retrievalReferenceNumber()
                     * .traceNumber()
                     * .transactionId()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [NetworkIdentifiers]. */
                class Builder internal constructor() {

                    private var authorizationIdentificationResponse: JsonField<String>? = null
                    private var retrievalReferenceNumber: JsonField<String>? = null
                    private var traceNumber: JsonField<String>? = null
                    private var transactionId: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(networkIdentifiers: NetworkIdentifiers) = apply {
                        authorizationIdentificationResponse =
                            networkIdentifiers.authorizationIdentificationResponse
                        retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber
                        traceNumber = networkIdentifiers.traceNumber
                        transactionId = networkIdentifiers.transactionId
                        additionalProperties =
                            networkIdentifiers.additionalProperties.toMutableMap()
                    }

                    /**
                     * The randomly generated 6-character Authorization Identification Response code
                     * sent back to the acquirer in an approved response.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: String?
                    ) =
                        authorizationIdentificationResponse(
                            JsonField.ofNullable(authorizationIdentificationResponse)
                        )

                    /**
                     * Alias for calling [Builder.authorizationIdentificationResponse] with
                     * `authorizationIdentificationResponse.orElse(null)`.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: Optional<String>
                    ) =
                        authorizationIdentificationResponse(
                            authorizationIdentificationResponse.getOrNull()
                        )

                    /**
                     * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON
                     * value.
                     *
                     * You should usually call [Builder.authorizationIdentificationResponse] with a
                     * well-typed [String] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: JsonField<String>
                    ) = apply {
                        this.authorizationIdentificationResponse =
                            authorizationIdentificationResponse
                    }

                    /**
                     * A life-cycle identifier used across e.g., an authorization and a reversal.
                     * Expected to be unique per acquirer within a window of time. For some card
                     * networks the retrieval reference number includes the trace counter.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: String?) =
                        retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber))

                    /**
                     * Alias for calling [Builder.retrievalReferenceNumber] with
                     * `retrievalReferenceNumber.orElse(null)`.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: Optional<String>) =
                        retrievalReferenceNumber(retrievalReferenceNumber.getOrNull())

                    /**
                     * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.retrievalReferenceNumber] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField<String>) =
                        apply {
                            this.retrievalReferenceNumber = retrievalReferenceNumber
                        }

                    /**
                     * A counter used to verify an individual authorization. Expected to be unique
                     * per acquirer within a window of time.
                     */
                    fun traceNumber(traceNumber: String?) =
                        traceNumber(JsonField.ofNullable(traceNumber))

                    /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */
                    fun traceNumber(traceNumber: Optional<String>) =
                        traceNumber(traceNumber.getOrNull())

                    /**
                     * Sets [Builder.traceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.traceNumber] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun traceNumber(traceNumber: JsonField<String>) = apply {
                        this.traceNumber = traceNumber
                    }

                    /**
                     * A globally unique transaction identifier provided by the card network, used
                     * across multiple life-cycle requests.
                     */
                    fun transactionId(transactionId: String?) =
                        transactionId(JsonField.ofNullable(transactionId))

                    /**
                     * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`.
                     */
                    fun transactionId(transactionId: Optional<String>) =
                        transactionId(transactionId.getOrNull())

                    /**
                     * Sets [Builder.transactionId] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.transactionId] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun transactionId(transactionId: JsonField<String>) = apply {
                        this.transactionId = transactionId
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [NetworkIdentifiers].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .authorizationIdentificationResponse()
                     * .retrievalReferenceNumber()
                     * .traceNumber()
                     * .transactionId()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): NetworkIdentifiers =
                        NetworkIdentifiers(
                            checkRequired(
                                "authorizationIdentificationResponse",
                                authorizationIdentificationResponse,
                            ),
                            checkRequired("retrievalReferenceNumber", retrievalReferenceNumber),
                            checkRequired("traceNumber", traceNumber),
                            checkRequired("transactionId", transactionId),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): NetworkIdentifiers = apply {
                    if (validated) {
                        return@apply
                    }

                    authorizationIdentificationResponse()
                    retrievalReferenceNumber()
                    traceNumber()
                    transactionId()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) +
                        (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) +
                        (if (traceNumber.asKnown().isPresent) 1 else 0) +
                        (if (transactionId.asKnown().isPresent) 1 else 0)

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is NetworkIdentifiers &&
                        authorizationIdentificationResponse ==
                            other.authorizationIdentificationResponse &&
                        retrievalReferenceNumber == other.retrievalReferenceNumber &&
                        traceNumber == other.traceNumber &&
                        transactionId == other.transactionId &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        authorizationIdentificationResponse,
                        retrievalReferenceNumber,
                        traceNumber,
                        transactionId,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}"
            }

            /**
             * The processing category describes the intent behind the financial, such as whether it
             * was used for bill payments or an automatic fuel dispenser.
             */
            class ProcessingCategory
            @JsonCreator
            private constructor(private val value: JsonField<String>) : Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /**
                     * Account funding transactions are transactions used to e.g., fund an account
                     * or transfer funds between accounts.
                     */
                    @JvmField val ACCOUNT_FUNDING = of("account_funding")

                    /**
                     * Automatic fuel dispenser authorizations occur when a card is used at a gas
                     * pump, prior to the actual transaction amount being known. They are followed
                     * by an advice message that updates the amount of the pending transaction.
                     */
                    @JvmField val AUTOMATIC_FUEL_DISPENSER = of("automatic_fuel_dispenser")

                    /** A transaction used to pay a bill. */
                    @JvmField val BILL_PAYMENT = of("bill_payment")

                    /** Original credit transactions are used to send money to a cardholder. */
                    @JvmField val ORIGINAL_CREDIT = of("original_credit")

                    /** A regular purchase. */
                    @JvmField val PURCHASE = of("purchase")

                    /**
                     * Quasi-cash transactions represent purchases of items which may be convertible
                     * to cash.
                     */
                    @JvmField val QUASI_CASH = of("quasi_cash")

                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    @JvmField val REFUND = of("refund")

                    /**
                     * Cash disbursement transactions are used to withdraw cash from an ATM or a
                     * point of sale.
                     */
                    @JvmField val CASH_DISBURSEMENT = of("cash_disbursement")

                    /**
                     * Cash deposit transactions are used to deposit cash at an ATM or a point of
                     * sale.
                     */
                    @JvmField val CASH_DEPOSIT = of("cash_deposit")

                    /**
                     * A balance inquiry transaction is used to check the balance of an account
                     * associated with a card.
                     */
                    @JvmField val BALANCE_INQUIRY = of("balance_inquiry")

                    /** The processing category is unknown. */
                    @JvmField val UNKNOWN = of("unknown")

                    @JvmStatic fun of(value: String) = ProcessingCategory(JsonField.of(value))
                }

                /** An enum containing [ProcessingCategory]'s known values. */
                enum class Known {
                    /**
                     * Account funding transactions are transactions used to e.g., fund an account
                     * or transfer funds between accounts.
                     */
                    ACCOUNT_FUNDING,
                    /**
                     * Automatic fuel dispenser authorizations occur when a card is used at a gas
                     * pump, prior to the actual transaction amount being known. They are followed
                     * by an advice message that updates the amount of the pending transaction.
                     */
                    AUTOMATIC_FUEL_DISPENSER,
                    /** A transaction used to pay a bill. */
                    BILL_PAYMENT,
                    /** Original credit transactions are used to send money to a cardholder. */
                    ORIGINAL_CREDIT,
                    /** A regular purchase. */
                    PURCHASE,
                    /**
                     * Quasi-cash transactions represent purchases of items which may be convertible
                     * to cash.
                     */
                    QUASI_CASH,
                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    REFUND,
                    /**
                     * Cash disbursement transactions are used to withdraw cash from an ATM or a
                     * point of sale.
                     */
                    CASH_DISBURSEMENT,
                    /**
                     * Cash deposit transactions are used to deposit cash at an ATM or a point of
                     * sale.
                     */
                    CASH_DEPOSIT,
                    /**
                     * A balance inquiry transaction is used to check the balance of an account
                     * associated with a card.
                     */
                    BALANCE_INQUIRY,
                    /** The processing category is unknown. */
                    UNKNOWN,
                }

                /**
                 * An enum containing [ProcessingCategory]'s known values, as well as an [_UNKNOWN]
                 * member.
                 *
                 * An instance of [ProcessingCategory] can contain an unknown value in a couple of
                 * cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /**
                     * Account funding transactions are transactions used to e.g., fund an account
                     * or transfer funds between accounts.
                     */
                    ACCOUNT_FUNDING,
                    /**
                     * Automatic fuel dispenser authorizations occur when a card is used at a gas
                     * pump, prior to the actual transaction amount being known. They are followed
                     * by an advice message that updates the amount of the pending transaction.
                     */
                    AUTOMATIC_FUEL_DISPENSER,
                    /** A transaction used to pay a bill. */
                    BILL_PAYMENT,
                    /** Original credit transactions are used to send money to a cardholder. */
                    ORIGINAL_CREDIT,
                    /** A regular purchase. */
                    PURCHASE,
                    /**
                     * Quasi-cash transactions represent purchases of items which may be convertible
                     * to cash.
                     */
                    QUASI_CASH,
                    /**
                     * A refund card authorization, sometimes referred to as a credit voucher
                     * authorization, where funds are credited to the cardholder.
                     */
                    REFUND,
                    /**
                     * Cash disbursement transactions are used to withdraw cash from an ATM or a
                     * point of sale.
                     */
                    CASH_DISBURSEMENT,
                    /**
                     * Cash deposit transactions are used to deposit cash at an ATM or a point of
                     * sale.
                     */
                    CASH_DEPOSIT,
                    /**
                     * A balance inquiry transaction is used to check the balance of an account
                     * associated with a card.
                     */
                    BALANCE_INQUIRY,
                    /** The processing category is unknown. */
                    UNKNOWN,
                    /**
                     * An enum member indicating that [ProcessingCategory] was instantiated with an
                     * unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        ACCOUNT_FUNDING -> Value.ACCOUNT_FUNDING
                        AUTOMATIC_FUEL_DISPENSER -> Value.AUTOMATIC_FUEL_DISPENSER
                        BILL_PAYMENT -> Value.BILL_PAYMENT
                        ORIGINAL_CREDIT -> Value.ORIGINAL_CREDIT
                        PURCHASE -> Value.PURCHASE
                        QUASI_CASH -> Value.QUASI_CASH
                        REFUND -> Value.REFUND
                        CASH_DISBURSEMENT -> Value.CASH_DISBURSEMENT
                        CASH_DEPOSIT -> Value.CASH_DEPOSIT
                        BALANCE_INQUIRY -> Value.BALANCE_INQUIRY
                        UNKNOWN -> Value.UNKNOWN
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        ACCOUNT_FUNDING -> Known.ACCOUNT_FUNDING
                        AUTOMATIC_FUEL_DISPENSER -> Known.AUTOMATIC_FUEL_DISPENSER
                        BILL_PAYMENT -> Known.BILL_PAYMENT
                        ORIGINAL_CREDIT -> Known.ORIGINAL_CREDIT
                        PURCHASE -> Known.PURCHASE
                        QUASI_CASH -> Known.QUASI_CASH
                        REFUND -> Known.REFUND
                        CASH_DISBURSEMENT -> Known.CASH_DISBURSEMENT
                        CASH_DEPOSIT -> Known.CASH_DEPOSIT
                        BALANCE_INQUIRY -> Known.BALANCE_INQUIRY
                        UNKNOWN -> Known.UNKNOWN
                        else ->
                            throw IncreaseInvalidDataException("Unknown ProcessingCategory: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): ProcessingCategory = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is ProcessingCategory && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            class SchemeFee
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val amount: JsonField<String>,
                private val createdAt: JsonField<OffsetDateTime>,
                private val currency: JsonField<Currency>,
                private val feeType: JsonField<FeeType>,
                private val fixedComponent: JsonField<String>,
                private val variableRate: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("amount")
                    @ExcludeMissing
                    amount: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("created_at")
                    @ExcludeMissing
                    createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                    @JsonProperty("currency")
                    @ExcludeMissing
                    currency: JsonField<Currency> = JsonMissing.of(),
                    @JsonProperty("fee_type")
                    @ExcludeMissing
                    feeType: JsonField<FeeType> = JsonMissing.of(),
                    @JsonProperty("fixed_component")
                    @ExcludeMissing
                    fixedComponent: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("variable_rate")
                    @ExcludeMissing
                    variableRate: JsonField<String> = JsonMissing.of(),
                ) : this(
                    amount,
                    createdAt,
                    currency,
                    feeType,
                    fixedComponent,
                    variableRate,
                    mutableMapOf(),
                )

                /**
                 * The fee amount given as a string containing a decimal number.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun amount(): String = amount.getRequired("amount")

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was
                 * created.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /**
                 * The type of fee being assessed.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun feeType(): FeeType = feeType.getRequired("fee_type")

                /**
                 * The fixed component of the fee, if applicable, given in major units of the fee
                 * amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun fixedComponent(): Optional<String> =
                    fixedComponent.getOptional("fixed_component")

                /**
                 * The variable rate component of the fee, if applicable, given as a decimal (e.g.,
                 * 0.015 for 1.5%).
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun variableRate(): Optional<String> = variableRate.getOptional("variable_rate")

                /**
                 * Returns the raw JSON value of [amount].
                 *
                 * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<String> = amount

                /**
                 * Returns the raw JSON value of [createdAt].
                 *
                 * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("created_at")
                @ExcludeMissing
                fun _createdAt(): JsonField<OffsetDateTime> = createdAt

                /**
                 * Returns the raw JSON value of [currency].
                 *
                 * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun _currency(): JsonField<Currency> = currency

                /**
                 * Returns the raw JSON value of [feeType].
                 *
                 * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("fee_type")
                @ExcludeMissing
                fun _feeType(): JsonField<FeeType> = feeType

                /**
                 * Returns the raw JSON value of [fixedComponent].
                 *
                 * Unlike [fixedComponent], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("fixed_component")
                @ExcludeMissing
                fun _fixedComponent(): JsonField<String> = fixedComponent

                /**
                 * Returns the raw JSON value of [variableRate].
                 *
                 * Unlike [variableRate], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("variable_rate")
                @ExcludeMissing
                fun _variableRate(): JsonField<String> = variableRate

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [SchemeFee].
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [SchemeFee]. */
                class Builder internal constructor() {

                    private var amount: JsonField<String>? = null
                    private var createdAt: JsonField<OffsetDateTime>? = null
                    private var currency: JsonField<Currency>? = null
                    private var feeType: JsonField<FeeType>? = null
                    private var fixedComponent: JsonField<String>? = null
                    private var variableRate: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(schemeFee: SchemeFee) = apply {
                        amount = schemeFee.amount
                        createdAt = schemeFee.createdAt
                        currency = schemeFee.currency
                        feeType = schemeFee.feeType
                        fixedComponent = schemeFee.fixedComponent
                        variableRate = schemeFee.variableRate
                        additionalProperties = schemeFee.additionalProperties.toMutableMap()
                    }

                    /** The fee amount given as a string containing a decimal number. */
                    fun amount(amount: String) = amount(JsonField.of(amount))

                    /**
                     * Sets [Builder.amount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.amount] with a well-typed [String] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun amount(amount: JsonField<String>) = apply { this.amount = amount }

                    /**
                     * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee
                     * was created.
                     */
                    fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt))

                    /**
                     * Sets [Builder.createdAt] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.createdAt] with a well-typed
                     * [OffsetDateTime] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply {
                        this.createdAt = createdAt
                    }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                     * reimbursement.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * Sets [Builder.currency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.currency] with a well-typed [Currency] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                    /** The type of fee being assessed. */
                    fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType))

                    /**
                     * Sets [Builder.feeType] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.feeType] with a well-typed [FeeType] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun feeType(feeType: JsonField<FeeType>) = apply { this.feeType = feeType }

                    /**
                     * The fixed component of the fee, if applicable, given in major units of the
                     * fee amount.
                     */
                    fun fixedComponent(fixedComponent: String?) =
                        fixedComponent(JsonField.ofNullable(fixedComponent))

                    /**
                     * Alias for calling [Builder.fixedComponent] with
                     * `fixedComponent.orElse(null)`.
                     */
                    fun fixedComponent(fixedComponent: Optional<String>) =
                        fixedComponent(fixedComponent.getOrNull())

                    /**
                     * Sets [Builder.fixedComponent] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.fixedComponent] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun fixedComponent(fixedComponent: JsonField<String>) = apply {
                        this.fixedComponent = fixedComponent
                    }

                    /**
                     * The variable rate component of the fee, if applicable, given as a decimal
                     * (e.g., 0.015 for 1.5%).
                     */
                    fun variableRate(variableRate: String?) =
                        variableRate(JsonField.ofNullable(variableRate))

                    /**
                     * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`.
                     */
                    fun variableRate(variableRate: Optional<String>) =
                        variableRate(variableRate.getOrNull())

                    /**
                     * Sets [Builder.variableRate] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.variableRate] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun variableRate(variableRate: JsonField<String>) = apply {
                        this.variableRate = variableRate
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [SchemeFee].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): SchemeFee =
                        SchemeFee(
                            checkRequired("amount", amount),
                            checkRequired("createdAt", createdAt),
                            checkRequired("currency", currency),
                            checkRequired("feeType", feeType),
                            checkRequired("fixedComponent", fixedComponent),
                            checkRequired("variableRate", variableRate),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): SchemeFee = apply {
                    if (validated) {
                        return@apply
                    }

                    amount()
                    createdAt()
                    currency().validate()
                    feeType().validate()
                    fixedComponent()
                    variableRate()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (amount.asKnown().isPresent) 1 else 0) +
                        (if (createdAt.asKnown().isPresent) 1 else 0) +
                        (currency.asKnown().getOrNull()?.validity() ?: 0) +
                        (feeType.asKnown().getOrNull()?.validity() ?: 0) +
                        (if (fixedComponent.asKnown().isPresent) 1 else 0) +
                        (if (variableRate.asKnown().isPresent) 1 else 0)

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 */
                class Currency
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** US Dollar (USD) */
                        @JvmField val USD = of("USD")

                        @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                    }

                    /** An enum containing [Currency]'s known values. */
                    enum class Known {
                        /** US Dollar (USD) */
                        USD
                    }

                    /**
                     * An enum containing [Currency]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Currency] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** US Dollar (USD) */
                        USD,
                        /**
                         * An enum member indicating that [Currency] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            USD -> Value.USD
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            USD -> Known.USD
                            else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Currency = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Currency && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** The type of fee being assessed. */
                class FeeType
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY =
                            of("visa_international_service_assessment_single_currency")

                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY =
                            of("visa_international_service_assessment_cross_currency")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE =
                            of("visa_authorization_domestic_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_international_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE =
                            of("visa_authorization_canada_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_international_point_of_sale")

                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE =
                            of("visa_authorization_address_verification_service")

                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        @JvmField
                        val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization")

                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission")

                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_DOMESTIC =
                            of("visa_account_verification_domestic")

                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL =
                            of("visa_account_verification_international")

                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_CANADA =
                            of("visa_account_verification_canada")

                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee")

                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        @JvmField
                        val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE =
                            of("visa_consumer_debit_acceptance_fee")

                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        @JvmField
                        val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE =
                            of("visa_business_debit_acceptance_fee")

                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee")

                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic")

                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        @JvmField
                        val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international")

                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token")

                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token")

                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission")

                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization")

                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        @JvmField
                        val VISA_DIRECT_TRANSACTION_DOMESTIC =
                            of("visa_direct_transaction_domestic")

                        /** Issuer card service fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit")

                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT =
                            of("visa_advertising_service_commercial_credit")

                        /** Issuer Community Growth Acceleration Program Fee. */
                        @JvmField
                        val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM =
                            of("visa_community_growth_acceleration_program")

                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        @JvmField
                        val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT =
                            of("visa_processing_guarantee_commercial_credit")

                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee")

                        @JvmStatic fun of(value: String) = FeeType(JsonField.of(value))
                    }

                    /** An enum containing [FeeType]'s known values. */
                    enum class Known {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                    }

                    /**
                     * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member.
                     *
                     * An instance of [FeeType] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                        /**
                         * An enum member indicating that [FeeType] was instantiated with an unknown
                         * value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Value.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Value.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Known.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Known.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE
                            else -> throw IncreaseInvalidDataException("Unknown FeeType: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): FeeType = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is FeeType && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is SchemeFee &&
                        amount == other.amount &&
                        createdAt == other.createdAt &&
                        currency == other.currency &&
                        feeType == other.feeType &&
                        fixedComponent == other.fixedComponent &&
                        variableRate == other.variableRate &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        amount,
                        createdAt,
                        currency,
                        feeType,
                        fixedComponent,
                        variableRate,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}"
            }

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_financial`.
             */
            class Type @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    @JvmField val CARD_FINANCIAL = of("card_financial")

                    @JvmStatic fun of(value: String) = Type(JsonField.of(value))
                }

                /** An enum containing [Type]'s known values. */
                enum class Known {
                    CARD_FINANCIAL
                }

                /**
                 * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Type] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    CARD_FINANCIAL,
                    /**
                     * An enum member indicating that [Type] was instantiated with an unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        CARD_FINANCIAL -> Value.CARD_FINANCIAL
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        CARD_FINANCIAL -> Known.CARD_FINANCIAL
                        else -> throw IncreaseInvalidDataException("Unknown Type: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Type = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Type && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** Fields related to verification of cardholder-provided values. */
            class Verification
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val cardVerificationCode: JsonField<CardVerificationCode>,
                private val cardholderAddress: JsonField<CardholderAddress>,
                private val cardholderName: JsonField<CardholderName>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("card_verification_code")
                    @ExcludeMissing
                    cardVerificationCode: JsonField<CardVerificationCode> = JsonMissing.of(),
                    @JsonProperty("cardholder_address")
                    @ExcludeMissing
                    cardholderAddress: JsonField<CardholderAddress> = JsonMissing.of(),
                    @JsonProperty("cardholder_name")
                    @ExcludeMissing
                    cardholderName: JsonField<CardholderName> = JsonMissing.of(),
                ) : this(cardVerificationCode, cardholderAddress, cardholderName, mutableMapOf())

                /**
                 * Fields related to verification of the Card Verification Code, a 3-digit code on
                 * the back of the card.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun cardVerificationCode(): CardVerificationCode =
                    cardVerificationCode.getRequired("card_verification_code")

                /**
                 * Cardholder address provided in the authorization request and the address on file
                 * we verified it against.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun cardholderAddress(): CardholderAddress =
                    cardholderAddress.getRequired("cardholder_address")

                /**
                 * Cardholder name provided in the authorization request.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun cardholderName(): Optional<CardholderName> =
                    cardholderName.getOptional("cardholder_name")

                /**
                 * Returns the raw JSON value of [cardVerificationCode].
                 *
                 * Unlike [cardVerificationCode], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("card_verification_code")
                @ExcludeMissing
                fun _cardVerificationCode(): JsonField<CardVerificationCode> = cardVerificationCode

                /**
                 * Returns the raw JSON value of [cardholderAddress].
                 *
                 * Unlike [cardholderAddress], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("cardholder_address")
                @ExcludeMissing
                fun _cardholderAddress(): JsonField<CardholderAddress> = cardholderAddress

                /**
                 * Returns the raw JSON value of [cardholderName].
                 *
                 * Unlike [cardholderName], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("cardholder_name")
                @ExcludeMissing
                fun _cardholderName(): JsonField<CardholderName> = cardholderName

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [Verification].
                     *
                     * The following fields are required:
                     * ```java
                     * .cardVerificationCode()
                     * .cardholderAddress()
                     * .cardholderName()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [Verification]. */
                class Builder internal constructor() {

                    private var cardVerificationCode: JsonField<CardVerificationCode>? = null
                    private var cardholderAddress: JsonField<CardholderAddress>? = null
                    private var cardholderName: JsonField<CardholderName>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(verification: Verification) = apply {
                        cardVerificationCode = verification.cardVerificationCode
                        cardholderAddress = verification.cardholderAddress
                        cardholderName = verification.cardholderName
                        additionalProperties = verification.additionalProperties.toMutableMap()
                    }

                    /**
                     * Fields related to verification of the Card Verification Code, a 3-digit code
                     * on the back of the card.
                     */
                    fun cardVerificationCode(cardVerificationCode: CardVerificationCode) =
                        cardVerificationCode(JsonField.of(cardVerificationCode))

                    /**
                     * Sets [Builder.cardVerificationCode] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.cardVerificationCode] with a well-typed
                     * [CardVerificationCode] value instead. This method is primarily for setting
                     * the field to an undocumented or not yet supported value.
                     */
                    fun cardVerificationCode(
                        cardVerificationCode: JsonField<CardVerificationCode>
                    ) = apply { this.cardVerificationCode = cardVerificationCode }

                    /**
                     * Cardholder address provided in the authorization request and the address on
                     * file we verified it against.
                     */
                    fun cardholderAddress(cardholderAddress: CardholderAddress) =
                        cardholderAddress(JsonField.of(cardholderAddress))

                    /**
                     * Sets [Builder.cardholderAddress] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.cardholderAddress] with a well-typed
                     * [CardholderAddress] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun cardholderAddress(cardholderAddress: JsonField<CardholderAddress>) = apply {
                        this.cardholderAddress = cardholderAddress
                    }

                    /** Cardholder name provided in the authorization request. */
                    fun cardholderName(cardholderName: CardholderName?) =
                        cardholderName(JsonField.ofNullable(cardholderName))

                    /**
                     * Alias for calling [Builder.cardholderName] with
                     * `cardholderName.orElse(null)`.
                     */
                    fun cardholderName(cardholderName: Optional<CardholderName>) =
                        cardholderName(cardholderName.getOrNull())

                    /**
                     * Sets [Builder.cardholderName] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.cardholderName] with a well-typed
                     * [CardholderName] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun cardholderName(cardholderName: JsonField<CardholderName>) = apply {
                        this.cardholderName = cardholderName
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [Verification].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .cardVerificationCode()
                     * .cardholderAddress()
                     * .cardholderName()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): Verification =
                        Verification(
                            checkRequired("cardVerificationCode", cardVerificationCode),
                            checkRequired("cardholderAddress", cardholderAddress),
                            checkRequired("cardholderName", cardholderName),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Verification = apply {
                    if (validated) {
                        return@apply
                    }

                    cardVerificationCode().validate()
                    cardholderAddress().validate()
                    cardholderName().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (cardVerificationCode.asKnown().getOrNull()?.validity() ?: 0) +
                        (cardholderAddress.asKnown().getOrNull()?.validity() ?: 0) +
                        (cardholderName.asKnown().getOrNull()?.validity() ?: 0)

                /**
                 * Fields related to verification of the Card Verification Code, a 3-digit code on
                 * the back of the card.
                 */
                class CardVerificationCode
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val result: JsonField<Result>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("result")
                        @ExcludeMissing
                        result: JsonField<Result> = JsonMissing.of()
                    ) : this(result, mutableMapOf())

                    /**
                     * The result of verifying the Card Verification Code.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun result(): Result = result.getRequired("result")

                    /**
                     * Returns the raw JSON value of [result].
                     *
                     * Unlike [result], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("result")
                    @ExcludeMissing
                    fun _result(): JsonField<Result> = result

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [CardVerificationCode].
                         *
                         * The following fields are required:
                         * ```java
                         * .result()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CardVerificationCode]. */
                    class Builder internal constructor() {

                        private var result: JsonField<Result>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(cardVerificationCode: CardVerificationCode) = apply {
                            result = cardVerificationCode.result
                            additionalProperties =
                                cardVerificationCode.additionalProperties.toMutableMap()
                        }

                        /** The result of verifying the Card Verification Code. */
                        fun result(result: Result) = result(JsonField.of(result))

                        /**
                         * Sets [Builder.result] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.result] with a well-typed [Result] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun result(result: JsonField<Result>) = apply { this.result = result }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CardVerificationCode].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .result()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CardVerificationCode =
                            CardVerificationCode(
                                checkRequired("result", result),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CardVerificationCode = apply {
                        if (validated) {
                            return@apply
                        }

                        result().validate()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0)

                    /** The result of verifying the Card Verification Code. */
                    class Result
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /**
                             * No card verification code was provided in the authorization request.
                             */
                            @JvmField val NOT_CHECKED = of("not_checked")

                            /** The card verification code matched the one on file. */
                            @JvmField val MATCH = of("match")

                            /** The card verification code did not match the one on file. */
                            @JvmField val NO_MATCH = of("no_match")

                            @JvmStatic fun of(value: String) = Result(JsonField.of(value))
                        }

                        /** An enum containing [Result]'s known values. */
                        enum class Known {
                            /**
                             * No card verification code was provided in the authorization request.
                             */
                            NOT_CHECKED,
                            /** The card verification code matched the one on file. */
                            MATCH,
                            /** The card verification code did not match the one on file. */
                            NO_MATCH,
                        }

                        /**
                         * An enum containing [Result]'s known values, as well as an [_UNKNOWN]
                         * member.
                         *
                         * An instance of [Result] can contain an unknown value in a couple of
                         * cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /**
                             * No card verification code was provided in the authorization request.
                             */
                            NOT_CHECKED,
                            /** The card verification code matched the one on file. */
                            MATCH,
                            /** The card verification code did not match the one on file. */
                            NO_MATCH,
                            /**
                             * An enum member indicating that [Result] was instantiated with an
                             * unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NOT_CHECKED -> Value.NOT_CHECKED
                                MATCH -> Value.MATCH
                                NO_MATCH -> Value.NO_MATCH
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NOT_CHECKED -> Known.NOT_CHECKED
                                MATCH -> Known.MATCH
                                NO_MATCH -> Known.NO_MATCH
                                else -> throw IncreaseInvalidDataException("Unknown Result: $value")
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): Result = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is Result && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CardVerificationCode &&
                            result == other.result &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}"
                }

                /**
                 * Cardholder address provided in the authorization request and the address on file
                 * we verified it against.
                 */
                class CardholderAddress
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val actualLine1: JsonField<String>,
                    private val actualPostalCode: JsonField<String>,
                    private val providedLine1: JsonField<String>,
                    private val providedPostalCode: JsonField<String>,
                    private val result: JsonField<Result>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("actual_line1")
                        @ExcludeMissing
                        actualLine1: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("actual_postal_code")
                        @ExcludeMissing
                        actualPostalCode: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_line1")
                        @ExcludeMissing
                        providedLine1: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_postal_code")
                        @ExcludeMissing
                        providedPostalCode: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("result")
                        @ExcludeMissing
                        result: JsonField<Result> = JsonMissing.of(),
                    ) : this(
                        actualLine1,
                        actualPostalCode,
                        providedLine1,
                        providedPostalCode,
                        result,
                        mutableMapOf(),
                    )

                    /**
                     * Line 1 of the address on file for the cardholder.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun actualLine1(): Optional<String> = actualLine1.getOptional("actual_line1")

                    /**
                     * The postal code of the address on file for the cardholder.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun actualPostalCode(): Optional<String> =
                        actualPostalCode.getOptional("actual_postal_code")

                    /**
                     * The cardholder address line 1 provided for verification in the authorization
                     * request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedLine1(): Optional<String> =
                        providedLine1.getOptional("provided_line1")

                    /**
                     * The postal code provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedPostalCode(): Optional<String> =
                        providedPostalCode.getOptional("provided_postal_code")

                    /**
                     * The address verification result returned to the card network.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun result(): Result = result.getRequired("result")

                    /**
                     * Returns the raw JSON value of [actualLine1].
                     *
                     * Unlike [actualLine1], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("actual_line1")
                    @ExcludeMissing
                    fun _actualLine1(): JsonField<String> = actualLine1

                    /**
                     * Returns the raw JSON value of [actualPostalCode].
                     *
                     * Unlike [actualPostalCode], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("actual_postal_code")
                    @ExcludeMissing
                    fun _actualPostalCode(): JsonField<String> = actualPostalCode

                    /**
                     * Returns the raw JSON value of [providedLine1].
                     *
                     * Unlike [providedLine1], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("provided_line1")
                    @ExcludeMissing
                    fun _providedLine1(): JsonField<String> = providedLine1

                    /**
                     * Returns the raw JSON value of [providedPostalCode].
                     *
                     * Unlike [providedPostalCode], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("provided_postal_code")
                    @ExcludeMissing
                    fun _providedPostalCode(): JsonField<String> = providedPostalCode

                    /**
                     * Returns the raw JSON value of [result].
                     *
                     * Unlike [result], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("result")
                    @ExcludeMissing
                    fun _result(): JsonField<Result> = result

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [CardholderAddress].
                         *
                         * The following fields are required:
                         * ```java
                         * .actualLine1()
                         * .actualPostalCode()
                         * .providedLine1()
                         * .providedPostalCode()
                         * .result()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CardholderAddress]. */
                    class Builder internal constructor() {

                        private var actualLine1: JsonField<String>? = null
                        private var actualPostalCode: JsonField<String>? = null
                        private var providedLine1: JsonField<String>? = null
                        private var providedPostalCode: JsonField<String>? = null
                        private var result: JsonField<Result>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(cardholderAddress: CardholderAddress) = apply {
                            actualLine1 = cardholderAddress.actualLine1
                            actualPostalCode = cardholderAddress.actualPostalCode
                            providedLine1 = cardholderAddress.providedLine1
                            providedPostalCode = cardholderAddress.providedPostalCode
                            result = cardholderAddress.result
                            additionalProperties =
                                cardholderAddress.additionalProperties.toMutableMap()
                        }

                        /** Line 1 of the address on file for the cardholder. */
                        fun actualLine1(actualLine1: String?) =
                            actualLine1(JsonField.ofNullable(actualLine1))

                        /**
                         * Alias for calling [Builder.actualLine1] with `actualLine1.orElse(null)`.
                         */
                        fun actualLine1(actualLine1: Optional<String>) =
                            actualLine1(actualLine1.getOrNull())

                        /**
                         * Sets [Builder.actualLine1] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.actualLine1] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun actualLine1(actualLine1: JsonField<String>) = apply {
                            this.actualLine1 = actualLine1
                        }

                        /** The postal code of the address on file for the cardholder. */
                        fun actualPostalCode(actualPostalCode: String?) =
                            actualPostalCode(JsonField.ofNullable(actualPostalCode))

                        /**
                         * Alias for calling [Builder.actualPostalCode] with
                         * `actualPostalCode.orElse(null)`.
                         */
                        fun actualPostalCode(actualPostalCode: Optional<String>) =
                            actualPostalCode(actualPostalCode.getOrNull())

                        /**
                         * Sets [Builder.actualPostalCode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.actualPostalCode] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun actualPostalCode(actualPostalCode: JsonField<String>) = apply {
                            this.actualPostalCode = actualPostalCode
                        }

                        /**
                         * The cardholder address line 1 provided for verification in the
                         * authorization request.
                         */
                        fun providedLine1(providedLine1: String?) =
                            providedLine1(JsonField.ofNullable(providedLine1))

                        /**
                         * Alias for calling [Builder.providedLine1] with
                         * `providedLine1.orElse(null)`.
                         */
                        fun providedLine1(providedLine1: Optional<String>) =
                            providedLine1(providedLine1.getOrNull())

                        /**
                         * Sets [Builder.providedLine1] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedLine1] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedLine1(providedLine1: JsonField<String>) = apply {
                            this.providedLine1 = providedLine1
                        }

                        /**
                         * The postal code provided for verification in the authorization request.
                         */
                        fun providedPostalCode(providedPostalCode: String?) =
                            providedPostalCode(JsonField.ofNullable(providedPostalCode))

                        /**
                         * Alias for calling [Builder.providedPostalCode] with
                         * `providedPostalCode.orElse(null)`.
                         */
                        fun providedPostalCode(providedPostalCode: Optional<String>) =
                            providedPostalCode(providedPostalCode.getOrNull())

                        /**
                         * Sets [Builder.providedPostalCode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedPostalCode] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedPostalCode(providedPostalCode: JsonField<String>) = apply {
                            this.providedPostalCode = providedPostalCode
                        }

                        /** The address verification result returned to the card network. */
                        fun result(result: Result) = result(JsonField.of(result))

                        /**
                         * Sets [Builder.result] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.result] with a well-typed [Result] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun result(result: JsonField<Result>) = apply { this.result = result }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CardholderAddress].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .actualLine1()
                         * .actualPostalCode()
                         * .providedLine1()
                         * .providedPostalCode()
                         * .result()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CardholderAddress =
                            CardholderAddress(
                                checkRequired("actualLine1", actualLine1),
                                checkRequired("actualPostalCode", actualPostalCode),
                                checkRequired("providedLine1", providedLine1),
                                checkRequired("providedPostalCode", providedPostalCode),
                                checkRequired("result", result),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CardholderAddress = apply {
                        if (validated) {
                            return@apply
                        }

                        actualLine1()
                        actualPostalCode()
                        providedLine1()
                        providedPostalCode()
                        result().validate()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (actualLine1.asKnown().isPresent) 1 else 0) +
                            (if (actualPostalCode.asKnown().isPresent) 1 else 0) +
                            (if (providedLine1.asKnown().isPresent) 1 else 0) +
                            (if (providedPostalCode.asKnown().isPresent) 1 else 0) +
                            (result.asKnown().getOrNull()?.validity() ?: 0)

                    /** The address verification result returned to the card network. */
                    class Result
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** No address information was provided in the authorization request. */
                            @JvmField val NOT_CHECKED = of("not_checked")

                            /**
                             * Postal code matches, but the street address does not match or was not
                             * provided.
                             */
                            @JvmField
                            val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH =
                                of("postal_code_match_address_no_match")

                            /**
                             * Postal code does not match, but the street address matches or was not
                             * provided.
                             */
                            @JvmField
                            val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH =
                                of("postal_code_no_match_address_match")

                            /** Postal code and street address match. */
                            @JvmField val MATCH = of("match")

                            /** Postal code and street address do not match. */
                            @JvmField val NO_MATCH = of("no_match")

                            /**
                             * Postal code matches, but the street address was not verified.
                             * (deprecated)
                             */
                            @JvmField
                            val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED =
                                of("postal_code_match_address_not_checked")

                            @JvmStatic fun of(value: String) = Result(JsonField.of(value))
                        }

                        /** An enum containing [Result]'s known values. */
                        enum class Known {
                            /** No address information was provided in the authorization request. */
                            NOT_CHECKED,
                            /**
                             * Postal code matches, but the street address does not match or was not
                             * provided.
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NO_MATCH,
                            /**
                             * Postal code does not match, but the street address matches or was not
                             * provided.
                             */
                            POSTAL_CODE_NO_MATCH_ADDRESS_MATCH,
                            /** Postal code and street address match. */
                            MATCH,
                            /** Postal code and street address do not match. */
                            NO_MATCH,
                            /**
                             * Postal code matches, but the street address was not verified.
                             * (deprecated)
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED,
                        }

                        /**
                         * An enum containing [Result]'s known values, as well as an [_UNKNOWN]
                         * member.
                         *
                         * An instance of [Result] can contain an unknown value in a couple of
                         * cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** No address information was provided in the authorization request. */
                            NOT_CHECKED,
                            /**
                             * Postal code matches, but the street address does not match or was not
                             * provided.
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NO_MATCH,
                            /**
                             * Postal code does not match, but the street address matches or was not
                             * provided.
                             */
                            POSTAL_CODE_NO_MATCH_ADDRESS_MATCH,
                            /** Postal code and street address match. */
                            MATCH,
                            /** Postal code and street address do not match. */
                            NO_MATCH,
                            /**
                             * Postal code matches, but the street address was not verified.
                             * (deprecated)
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED,
                            /**
                             * An enum member indicating that [Result] was instantiated with an
                             * unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NOT_CHECKED -> Value.NOT_CHECKED
                                POSTAL_CODE_MATCH_ADDRESS_NO_MATCH ->
                                    Value.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH
                                POSTAL_CODE_NO_MATCH_ADDRESS_MATCH ->
                                    Value.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH
                                MATCH -> Value.MATCH
                                NO_MATCH -> Value.NO_MATCH
                                POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED ->
                                    Value.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NOT_CHECKED -> Known.NOT_CHECKED
                                POSTAL_CODE_MATCH_ADDRESS_NO_MATCH ->
                                    Known.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH
                                POSTAL_CODE_NO_MATCH_ADDRESS_MATCH ->
                                    Known.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH
                                MATCH -> Known.MATCH
                                NO_MATCH -> Known.NO_MATCH
                                POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED ->
                                    Known.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED
                                else -> throw IncreaseInvalidDataException("Unknown Result: $value")
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): Result = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is Result && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CardholderAddress &&
                            actualLine1 == other.actualLine1 &&
                            actualPostalCode == other.actualPostalCode &&
                            providedLine1 == other.providedLine1 &&
                            providedPostalCode == other.providedPostalCode &&
                            result == other.result &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            actualLine1,
                            actualPostalCode,
                            providedLine1,
                            providedPostalCode,
                            result,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}"
                }

                /** Cardholder name provided in the authorization request. */
                class CardholderName
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val providedFirstName: JsonField<String>,
                    private val providedLastName: JsonField<String>,
                    private val providedMiddleName: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("provided_first_name")
                        @ExcludeMissing
                        providedFirstName: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_last_name")
                        @ExcludeMissing
                        providedLastName: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_middle_name")
                        @ExcludeMissing
                        providedMiddleName: JsonField<String> = JsonMissing.of(),
                    ) : this(
                        providedFirstName,
                        providedLastName,
                        providedMiddleName,
                        mutableMapOf(),
                    )

                    /**
                     * The first name provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedFirstName(): Optional<String> =
                        providedFirstName.getOptional("provided_first_name")

                    /**
                     * The last name provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedLastName(): Optional<String> =
                        providedLastName.getOptional("provided_last_name")

                    /**
                     * The middle name provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedMiddleName(): Optional<String> =
                        providedMiddleName.getOptional("provided_middle_name")

                    /**
                     * Returns the raw JSON value of [providedFirstName].
                     *
                     * Unlike [providedFirstName], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("provided_first_name")
                    @ExcludeMissing
                    fun _providedFirstName(): JsonField<String> = providedFirstName

                    /**
                     * Returns the raw JSON value of [providedLastName].
                     *
                     * Unlike [providedLastName], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("provided_last_name")
                    @ExcludeMissing
                    fun _providedLastName(): JsonField<String> = providedLastName

                    /**
                     * Returns the raw JSON value of [providedMiddleName].
                     *
                     * Unlike [providedMiddleName], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("provided_middle_name")
                    @ExcludeMissing
                    fun _providedMiddleName(): JsonField<String> = providedMiddleName

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [CardholderName].
                         *
                         * The following fields are required:
                         * ```java
                         * .providedFirstName()
                         * .providedLastName()
                         * .providedMiddleName()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CardholderName]. */
                    class Builder internal constructor() {

                        private var providedFirstName: JsonField<String>? = null
                        private var providedLastName: JsonField<String>? = null
                        private var providedMiddleName: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(cardholderName: CardholderName) = apply {
                            providedFirstName = cardholderName.providedFirstName
                            providedLastName = cardholderName.providedLastName
                            providedMiddleName = cardholderName.providedMiddleName
                            additionalProperties =
                                cardholderName.additionalProperties.toMutableMap()
                        }

                        /**
                         * The first name provided for verification in the authorization request.
                         */
                        fun providedFirstName(providedFirstName: String?) =
                            providedFirstName(JsonField.ofNullable(providedFirstName))

                        /**
                         * Alias for calling [Builder.providedFirstName] with
                         * `providedFirstName.orElse(null)`.
                         */
                        fun providedFirstName(providedFirstName: Optional<String>) =
                            providedFirstName(providedFirstName.getOrNull())

                        /**
                         * Sets [Builder.providedFirstName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedFirstName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedFirstName(providedFirstName: JsonField<String>) = apply {
                            this.providedFirstName = providedFirstName
                        }

                        /** The last name provided for verification in the authorization request. */
                        fun providedLastName(providedLastName: String?) =
                            providedLastName(JsonField.ofNullable(providedLastName))

                        /**
                         * Alias for calling [Builder.providedLastName] with
                         * `providedLastName.orElse(null)`.
                         */
                        fun providedLastName(providedLastName: Optional<String>) =
                            providedLastName(providedLastName.getOrNull())

                        /**
                         * Sets [Builder.providedLastName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedLastName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedLastName(providedLastName: JsonField<String>) = apply {
                            this.providedLastName = providedLastName
                        }

                        /**
                         * The middle name provided for verification in the authorization request.
                         */
                        fun providedMiddleName(providedMiddleName: String?) =
                            providedMiddleName(JsonField.ofNullable(providedMiddleName))

                        /**
                         * Alias for calling [Builder.providedMiddleName] with
                         * `providedMiddleName.orElse(null)`.
                         */
                        fun providedMiddleName(providedMiddleName: Optional<String>) =
                            providedMiddleName(providedMiddleName.getOrNull())

                        /**
                         * Sets [Builder.providedMiddleName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedMiddleName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedMiddleName(providedMiddleName: JsonField<String>) = apply {
                            this.providedMiddleName = providedMiddleName
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CardholderName].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .providedFirstName()
                         * .providedLastName()
                         * .providedMiddleName()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CardholderName =
                            CardholderName(
                                checkRequired("providedFirstName", providedFirstName),
                                checkRequired("providedLastName", providedLastName),
                                checkRequired("providedMiddleName", providedMiddleName),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CardholderName = apply {
                        if (validated) {
                            return@apply
                        }

                        providedFirstName()
                        providedLastName()
                        providedMiddleName()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (providedFirstName.asKnown().isPresent) 1 else 0) +
                            (if (providedLastName.asKnown().isPresent) 1 else 0) +
                            (if (providedMiddleName.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CardholderName &&
                            providedFirstName == other.providedFirstName &&
                            providedLastName == other.providedLastName &&
                            providedMiddleName == other.providedMiddleName &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            providedFirstName,
                            providedLastName,
                            providedMiddleName,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CardholderName{providedFirstName=$providedFirstName, providedLastName=$providedLastName, providedMiddleName=$providedMiddleName, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Verification &&
                        cardVerificationCode == other.cardVerificationCode &&
                        cardholderAddress == other.cardholderAddress &&
                        cardholderName == other.cardholderName &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        cardVerificationCode,
                        cardholderAddress,
                        cardholderName,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, cardholderName=$cardholderName, additionalProperties=$additionalProperties}"
            }

            override fun equals(other: Any?): Boolean {
                if (this === other) {
                    return true
                }

                return other is CardFinancial &&
                    id == other.id &&
                    actioner == other.actioner &&
                    additionalAmounts == other.additionalAmounts &&
                    amount == other.amount &&
                    cardPaymentId == other.cardPaymentId &&
                    currency == other.currency &&
                    digitalWalletTokenId == other.digitalWalletTokenId &&
                    direction == other.direction &&
                    merchantAcceptorId == other.merchantAcceptorId &&
                    merchantCategoryCode == other.merchantCategoryCode &&
                    merchantCity == other.merchantCity &&
                    merchantCountry == other.merchantCountry &&
                    merchantDescriptor == other.merchantDescriptor &&
                    merchantPostalCode == other.merchantPostalCode &&
                    merchantState == other.merchantState &&
                    networkDetails == other.networkDetails &&
                    networkIdentifiers == other.networkIdentifiers &&
                    networkRiskScore == other.networkRiskScore &&
                    physicalCardId == other.physicalCardId &&
                    presentmentAmount == other.presentmentAmount &&
                    presentmentCurrency == other.presentmentCurrency &&
                    processingCategory == other.processingCategory &&
                    realTimeDecisionId == other.realTimeDecisionId &&
                    schemeFees == other.schemeFees &&
                    terminalId == other.terminalId &&
                    transactionId == other.transactionId &&
                    type == other.type &&
                    verification == other.verification &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    id,
                    actioner,
                    additionalAmounts,
                    amount,
                    cardPaymentId,
                    currency,
                    digitalWalletTokenId,
                    direction,
                    merchantAcceptorId,
                    merchantCategoryCode,
                    merchantCity,
                    merchantCountry,
                    merchantDescriptor,
                    merchantPostalCode,
                    merchantState,
                    networkDetails,
                    networkIdentifiers,
                    networkRiskScore,
                    physicalCardId,
                    presentmentAmount,
                    presentmentCurrency,
                    processingCategory,
                    realTimeDecisionId,
                    schemeFees,
                    terminalId,
                    transactionId,
                    type,
                    verification,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardFinancial{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, realTimeDecisionId=$realTimeDecisionId, schemeFees=$schemeFees, terminalId=$terminalId, transactionId=$transactionId, type=$type, verification=$verification, additionalProperties=$additionalProperties}"
        }

        /**
         * A Card Fuel Confirmation object. This field will be present in the JSON response if and
         * only if `category` is equal to `card_fuel_confirmation`. Card Fuel Confirmations update
         * the amount of a Card Authorization after a fuel pump transaction is completed.
         */
        class CardFuelConfirmation
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val id: JsonField<String>,
            private val cardAuthorizationId: JsonField<String>,
            private val currency: JsonField<Currency>,
            private val network: JsonField<Network>,
            private val networkIdentifiers: JsonField<NetworkIdentifiers>,
            private val pendingTransactionId: JsonField<String>,
            private val schemeFees: JsonField<List<SchemeFee>>,
            private val type: JsonField<Type>,
            private val updatedAuthorizationAmount: JsonField<Long>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
                @JsonProperty("card_authorization_id")
                @ExcludeMissing
                cardAuthorizationId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("network")
                @ExcludeMissing
                network: JsonField<Network> = JsonMissing.of(),
                @JsonProperty("network_identifiers")
                @ExcludeMissing
                networkIdentifiers: JsonField<NetworkIdentifiers> = JsonMissing.of(),
                @JsonProperty("pending_transaction_id")
                @ExcludeMissing
                pendingTransactionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("scheme_fees")
                @ExcludeMissing
                schemeFees: JsonField<List<SchemeFee>> = JsonMissing.of(),
                @JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
                @JsonProperty("updated_authorization_amount")
                @ExcludeMissing
                updatedAuthorizationAmount: JsonField<Long> = JsonMissing.of(),
            ) : this(
                id,
                cardAuthorizationId,
                currency,
                network,
                networkIdentifiers,
                pendingTransactionId,
                schemeFees,
                type,
                updatedAuthorizationAmount,
                mutableMapOf(),
            )

            /**
             * The Card Fuel Confirmation identifier.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun id(): String = id.getRequired("id")

            /**
             * The identifier for the Card Authorization this updates.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun cardAuthorizationId(): String =
                cardAuthorizationId.getRequired("card_authorization_id")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's
             * currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun currency(): Currency = currency.getRequired("currency")

            /**
             * The card network used to process this card authorization.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun network(): Network = network.getRequired("network")

            /**
             * Network-specific identifiers for a specific request or transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun networkIdentifiers(): NetworkIdentifiers =
                networkIdentifiers.getRequired("network_identifiers")

            /**
             * The identifier of the Pending Transaction associated with this Card Fuel
             * Confirmation.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun pendingTransactionId(): Optional<String> =
                pendingTransactionId.getOptional("pending_transaction_id")

            /**
             * The scheme fees associated with this card fuel confirmation.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun schemeFees(): List<SchemeFee> = schemeFees.getRequired("scheme_fees")

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_fuel_confirmation`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun type(): Type = type.getRequired("type")

            /**
             * The updated authorization amount after this fuel confirmation, in the minor unit of
             * the transaction's currency. For dollars, for example, this is cents.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun updatedAuthorizationAmount(): Long =
                updatedAuthorizationAmount.getRequired("updated_authorization_amount")

            /**
             * Returns the raw JSON value of [id].
             *
             * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id

            /**
             * Returns the raw JSON value of [cardAuthorizationId].
             *
             * Unlike [cardAuthorizationId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("card_authorization_id")
            @ExcludeMissing
            fun _cardAuthorizationId(): JsonField<String> = cardAuthorizationId

            /**
             * Returns the raw JSON value of [currency].
             *
             * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("currency")
            @ExcludeMissing
            fun _currency(): JsonField<Currency> = currency

            /**
             * Returns the raw JSON value of [network].
             *
             * Unlike [network], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("network") @ExcludeMissing fun _network(): JsonField<Network> = network

            /**
             * Returns the raw JSON value of [networkIdentifiers].
             *
             * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_identifiers")
            @ExcludeMissing
            fun _networkIdentifiers(): JsonField<NetworkIdentifiers> = networkIdentifiers

            /**
             * Returns the raw JSON value of [pendingTransactionId].
             *
             * Unlike [pendingTransactionId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("pending_transaction_id")
            @ExcludeMissing
            fun _pendingTransactionId(): JsonField<String> = pendingTransactionId

            /**
             * Returns the raw JSON value of [schemeFees].
             *
             * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("scheme_fees")
            @ExcludeMissing
            fun _schemeFees(): JsonField<List<SchemeFee>> = schemeFees

            /**
             * Returns the raw JSON value of [type].
             *
             * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("type") @ExcludeMissing fun _type(): JsonField<Type> = type

            /**
             * Returns the raw JSON value of [updatedAuthorizationAmount].
             *
             * Unlike [updatedAuthorizationAmount], this method doesn't throw if the JSON field has
             * an unexpected type.
             */
            @JsonProperty("updated_authorization_amount")
            @ExcludeMissing
            fun _updatedAuthorizationAmount(): JsonField<Long> = updatedAuthorizationAmount

            @JsonAnySetter
            private fun putAdditionalProperty(key: String, value: JsonValue) {
                additionalProperties.put(key, value)
            }

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map<String, JsonValue> =
                Collections.unmodifiableMap(additionalProperties)

            fun toBuilder() = Builder().from(this)

            companion object {

                /**
                 * Returns a mutable builder for constructing an instance of [CardFuelConfirmation].
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .cardAuthorizationId()
                 * .currency()
                 * .network()
                 * .networkIdentifiers()
                 * .pendingTransactionId()
                 * .schemeFees()
                 * .type()
                 * .updatedAuthorizationAmount()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

            /** A builder for [CardFuelConfirmation]. */
            class Builder internal constructor() {

                private var id: JsonField<String>? = null
                private var cardAuthorizationId: JsonField<String>? = null
                private var currency: JsonField<Currency>? = null
                private var network: JsonField<Network>? = null
                private var networkIdentifiers: JsonField<NetworkIdentifiers>? = null
                private var pendingTransactionId: JsonField<String>? = null
                private var schemeFees: JsonField<MutableList<SchemeFee>>? = null
                private var type: JsonField<Type>? = null
                private var updatedAuthorizationAmount: JsonField<Long>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardFuelConfirmation: CardFuelConfirmation) = apply {
                    id = cardFuelConfirmation.id
                    cardAuthorizationId = cardFuelConfirmation.cardAuthorizationId
                    currency = cardFuelConfirmation.currency
                    network = cardFuelConfirmation.network
                    networkIdentifiers = cardFuelConfirmation.networkIdentifiers
                    pendingTransactionId = cardFuelConfirmation.pendingTransactionId
                    schemeFees = cardFuelConfirmation.schemeFees.map { it.toMutableList() }
                    type = cardFuelConfirmation.type
                    updatedAuthorizationAmount = cardFuelConfirmation.updatedAuthorizationAmount
                    additionalProperties = cardFuelConfirmation.additionalProperties.toMutableMap()
                }

                /** The Card Fuel Confirmation identifier. */
                fun id(id: String) = id(JsonField.of(id))

                /**
                 * Sets [Builder.id] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.id] with a well-typed [String] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun id(id: JsonField<String>) = apply { this.id = id }

                /** The identifier for the Card Authorization this updates. */
                fun cardAuthorizationId(cardAuthorizationId: String) =
                    cardAuthorizationId(JsonField.of(cardAuthorizationId))

                /**
                 * Sets [Builder.cardAuthorizationId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cardAuthorizationId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun cardAuthorizationId(cardAuthorizationId: JsonField<String>) = apply {
                    this.cardAuthorizationId = cardAuthorizationId
                }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's
                 * currency.
                 */
                fun currency(currency: Currency) = currency(JsonField.of(currency))

                /**
                 * Sets [Builder.currency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.currency] with a well-typed [Currency] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                /** The card network used to process this card authorization. */
                fun network(network: Network) = network(JsonField.of(network))

                /**
                 * Sets [Builder.network] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.network] with a well-typed [Network] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun network(network: JsonField<Network>) = apply { this.network = network }

                /** Network-specific identifiers for a specific request or transaction. */
                fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) =
                    networkIdentifiers(JsonField.of(networkIdentifiers))

                /**
                 * Sets [Builder.networkIdentifiers] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkIdentifiers] with a well-typed
                 * [NetworkIdentifiers] value instead. This method is primarily for setting the
                 * field to an undocumented or not yet supported value.
                 */
                fun networkIdentifiers(networkIdentifiers: JsonField<NetworkIdentifiers>) = apply {
                    this.networkIdentifiers = networkIdentifiers
                }

                /**
                 * The identifier of the Pending Transaction associated with this Card Fuel
                 * Confirmation.
                 */
                fun pendingTransactionId(pendingTransactionId: String?) =
                    pendingTransactionId(JsonField.ofNullable(pendingTransactionId))

                /**
                 * Alias for calling [Builder.pendingTransactionId] with
                 * `pendingTransactionId.orElse(null)`.
                 */
                fun pendingTransactionId(pendingTransactionId: Optional<String>) =
                    pendingTransactionId(pendingTransactionId.getOrNull())

                /**
                 * Sets [Builder.pendingTransactionId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.pendingTransactionId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun pendingTransactionId(pendingTransactionId: JsonField<String>) = apply {
                    this.pendingTransactionId = pendingTransactionId
                }

                /** The scheme fees associated with this card fuel confirmation. */
                fun schemeFees(schemeFees: List<SchemeFee>) = schemeFees(JsonField.of(schemeFees))

                /**
                 * Sets [Builder.schemeFees] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.schemeFees] with a well-typed `List<SchemeFee>`
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun schemeFees(schemeFees: JsonField<List<SchemeFee>>) = apply {
                    this.schemeFees = schemeFees.map { it.toMutableList() }
                }

                /**
                 * Adds a single [SchemeFee] to [schemeFees].
                 *
                 * @throws IllegalStateException if the field was previously set to a non-list.
                 */
                fun addSchemeFee(schemeFee: SchemeFee) = apply {
                    schemeFees =
                        (schemeFees ?: JsonField.of(mutableListOf())).also {
                            checkKnown("schemeFees", it).add(schemeFee)
                        }
                }

                /**
                 * A constant representing the object's type. For this resource it will always be
                 * `card_fuel_confirmation`.
                 */
                fun type(type: Type) = type(JsonField.of(type))

                /**
                 * Sets [Builder.type] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.type] with a well-typed [Type] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun type(type: JsonField<Type>) = apply { this.type = type }

                /**
                 * The updated authorization amount after this fuel confirmation, in the minor unit
                 * of the transaction's currency. For dollars, for example, this is cents.
                 */
                fun updatedAuthorizationAmount(updatedAuthorizationAmount: Long) =
                    updatedAuthorizationAmount(JsonField.of(updatedAuthorizationAmount))

                /**
                 * Sets [Builder.updatedAuthorizationAmount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.updatedAuthorizationAmount] with a well-typed
                 * [Long] value instead. This method is primarily for setting the field to an
                 * undocumented or not yet supported value.
                 */
                fun updatedAuthorizationAmount(updatedAuthorizationAmount: JsonField<Long>) =
                    apply {
                        this.updatedAuthorizationAmount = updatedAuthorizationAmount
                    }

                fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                    this.additionalProperties.clear()
                    putAllAdditionalProperties(additionalProperties)
                }

                fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                    additionalProperties.put(key, value)
                }

                fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun removeAdditionalProperty(key: String) = apply {
                    additionalProperties.remove(key)
                }

                fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                    keys.forEach(::removeAdditionalProperty)
                }

                /**
                 * Returns an immutable instance of [CardFuelConfirmation].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .cardAuthorizationId()
                 * .currency()
                 * .network()
                 * .networkIdentifiers()
                 * .pendingTransactionId()
                 * .schemeFees()
                 * .type()
                 * .updatedAuthorizationAmount()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardFuelConfirmation =
                    CardFuelConfirmation(
                        checkRequired("id", id),
                        checkRequired("cardAuthorizationId", cardAuthorizationId),
                        checkRequired("currency", currency),
                        checkRequired("network", network),
                        checkRequired("networkIdentifiers", networkIdentifiers),
                        checkRequired("pendingTransactionId", pendingTransactionId),
                        checkRequired("schemeFees", schemeFees).map { it.toImmutable() },
                        checkRequired("type", type),
                        checkRequired("updatedAuthorizationAmount", updatedAuthorizationAmount),
                        additionalProperties.toMutableMap(),
                    )
            }

            private var validated: Boolean = false

            /**
             * Validates that the types of all values in this object match their expected types
             * recursively.
             *
             * This method is _not_ forwards compatible with new types from the API for existing
             * fields.
             *
             * @throws IncreaseInvalidDataException if any value type in this object doesn't match
             *   its expected type.
             */
            fun validate(): CardFuelConfirmation = apply {
                if (validated) {
                    return@apply
                }

                id()
                cardAuthorizationId()
                currency().validate()
                network().validate()
                networkIdentifiers().validate()
                pendingTransactionId()
                schemeFees().forEach { it.validate() }
                type().validate()
                updatedAuthorizationAmount()
                validated = true
            }

            fun isValid(): Boolean =
                try {
                    validate()
                    true
                } catch (e: IncreaseInvalidDataException) {
                    false
                }

            /**
             * Returns a score indicating how many valid values are contained in this object
             * recursively.
             *
             * Used for best match union deserialization.
             */
            @JvmSynthetic
            internal fun validity(): Int =
                (if (id.asKnown().isPresent) 1 else 0) +
                    (if (cardAuthorizationId.asKnown().isPresent) 1 else 0) +
                    (currency.asKnown().getOrNull()?.validity() ?: 0) +
                    (network.asKnown().getOrNull()?.validity() ?: 0) +
                    (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (pendingTransactionId.asKnown().isPresent) 1 else 0) +
                    (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
                    (type.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (updatedAuthorizationAmount.asKnown().isPresent) 1 else 0)

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's
             * currency.
             */
            class Currency @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** US Dollar (USD) */
                    @JvmField val USD = of("USD")

                    @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                }

                /** An enum containing [Currency]'s known values. */
                enum class Known {
                    /** US Dollar (USD) */
                    USD
                }

                /**
                 * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Currency] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** US Dollar (USD) */
                    USD,
                    /**
                     * An enum member indicating that [Currency] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        USD -> Value.USD
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        USD -> Known.USD
                        else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Currency = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Currency && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** The card network used to process this card authorization. */
            class Network @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** Visa */
                    @JvmField val VISA = of("visa")

                    /** Pulse */
                    @JvmField val PULSE = of("pulse")

                    @JvmStatic fun of(value: String) = Network(JsonField.of(value))
                }

                /** An enum containing [Network]'s known values. */
                enum class Known {
                    /** Visa */
                    VISA,
                    /** Pulse */
                    PULSE,
                }

                /**
                 * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Network] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** Visa */
                    VISA,
                    /** Pulse */
                    PULSE,
                    /**
                     * An enum member indicating that [Network] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        VISA -> Value.VISA
                        PULSE -> Value.PULSE
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        VISA -> Known.VISA
                        PULSE -> Known.PULSE
                        else -> throw IncreaseInvalidDataException("Unknown Network: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Network = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Network && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** Network-specific identifiers for a specific request or transaction. */
            class NetworkIdentifiers
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val authorizationIdentificationResponse: JsonField<String>,
                private val retrievalReferenceNumber: JsonField<String>,
                private val traceNumber: JsonField<String>,
                private val transactionId: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("authorization_identification_response")
                    @ExcludeMissing
                    authorizationIdentificationResponse: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("retrieval_reference_number")
                    @ExcludeMissing
                    retrievalReferenceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("trace_number")
                    @ExcludeMissing
                    traceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("transaction_id")
                    @ExcludeMissing
                    transactionId: JsonField<String> = JsonMissing.of(),
                ) : this(
                    authorizationIdentificationResponse,
                    retrievalReferenceNumber,
                    traceNumber,
                    transactionId,
                    mutableMapOf(),
                )

                /**
                 * The randomly generated 6-character Authorization Identification Response code
                 * sent back to the acquirer in an approved response.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun authorizationIdentificationResponse(): Optional<String> =
                    authorizationIdentificationResponse.getOptional(
                        "authorization_identification_response"
                    )

                /**
                 * A life-cycle identifier used across e.g., an authorization and a reversal.
                 * Expected to be unique per acquirer within a window of time. For some card
                 * networks the retrieval reference number includes the trace counter.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun retrievalReferenceNumber(): Optional<String> =
                    retrievalReferenceNumber.getOptional("retrieval_reference_number")

                /**
                 * A counter used to verify an individual authorization. Expected to be unique per
                 * acquirer within a window of time.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun traceNumber(): Optional<String> = traceNumber.getOptional("trace_number")

                /**
                 * A globally unique transaction identifier provided by the card network, used
                 * across multiple life-cycle requests.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun transactionId(): Optional<String> = transactionId.getOptional("transaction_id")

                /**
                 * Returns the raw JSON value of [authorizationIdentificationResponse].
                 *
                 * Unlike [authorizationIdentificationResponse], this method doesn't throw if the
                 * JSON field has an unexpected type.
                 */
                @JsonProperty("authorization_identification_response")
                @ExcludeMissing
                fun _authorizationIdentificationResponse(): JsonField<String> =
                    authorizationIdentificationResponse

                /**
                 * Returns the raw JSON value of [retrievalReferenceNumber].
                 *
                 * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field
                 * has an unexpected type.
                 */
                @JsonProperty("retrieval_reference_number")
                @ExcludeMissing
                fun _retrievalReferenceNumber(): JsonField<String> = retrievalReferenceNumber

                /**
                 * Returns the raw JSON value of [traceNumber].
                 *
                 * Unlike [traceNumber], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("trace_number")
                @ExcludeMissing
                fun _traceNumber(): JsonField<String> = traceNumber

                /**
                 * Returns the raw JSON value of [transactionId].
                 *
                 * Unlike [transactionId], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("transaction_id")
                @ExcludeMissing
                fun _transactionId(): JsonField<String> = transactionId

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of
                     * [NetworkIdentifiers].
                     *
                     * The following fields are required:
                     * ```java
                     * .authorizationIdentificationResponse()
                     * .retrievalReferenceNumber()
                     * .traceNumber()
                     * .transactionId()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [NetworkIdentifiers]. */
                class Builder internal constructor() {

                    private var authorizationIdentificationResponse: JsonField<String>? = null
                    private var retrievalReferenceNumber: JsonField<String>? = null
                    private var traceNumber: JsonField<String>? = null
                    private var transactionId: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(networkIdentifiers: NetworkIdentifiers) = apply {
                        authorizationIdentificationResponse =
                            networkIdentifiers.authorizationIdentificationResponse
                        retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber
                        traceNumber = networkIdentifiers.traceNumber
                        transactionId = networkIdentifiers.transactionId
                        additionalProperties =
                            networkIdentifiers.additionalProperties.toMutableMap()
                    }

                    /**
                     * The randomly generated 6-character Authorization Identification Response code
                     * sent back to the acquirer in an approved response.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: String?
                    ) =
                        authorizationIdentificationResponse(
                            JsonField.ofNullable(authorizationIdentificationResponse)
                        )

                    /**
                     * Alias for calling [Builder.authorizationIdentificationResponse] with
                     * `authorizationIdentificationResponse.orElse(null)`.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: Optional<String>
                    ) =
                        authorizationIdentificationResponse(
                            authorizationIdentificationResponse.getOrNull()
                        )

                    /**
                     * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON
                     * value.
                     *
                     * You should usually call [Builder.authorizationIdentificationResponse] with a
                     * well-typed [String] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: JsonField<String>
                    ) = apply {
                        this.authorizationIdentificationResponse =
                            authorizationIdentificationResponse
                    }

                    /**
                     * A life-cycle identifier used across e.g., an authorization and a reversal.
                     * Expected to be unique per acquirer within a window of time. For some card
                     * networks the retrieval reference number includes the trace counter.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: String?) =
                        retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber))

                    /**
                     * Alias for calling [Builder.retrievalReferenceNumber] with
                     * `retrievalReferenceNumber.orElse(null)`.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: Optional<String>) =
                        retrievalReferenceNumber(retrievalReferenceNumber.getOrNull())

                    /**
                     * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.retrievalReferenceNumber] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField<String>) =
                        apply {
                            this.retrievalReferenceNumber = retrievalReferenceNumber
                        }

                    /**
                     * A counter used to verify an individual authorization. Expected to be unique
                     * per acquirer within a window of time.
                     */
                    fun traceNumber(traceNumber: String?) =
                        traceNumber(JsonField.ofNullable(traceNumber))

                    /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */
                    fun traceNumber(traceNumber: Optional<String>) =
                        traceNumber(traceNumber.getOrNull())

                    /**
                     * Sets [Builder.traceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.traceNumber] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun traceNumber(traceNumber: JsonField<String>) = apply {
                        this.traceNumber = traceNumber
                    }

                    /**
                     * A globally unique transaction identifier provided by the card network, used
                     * across multiple life-cycle requests.
                     */
                    fun transactionId(transactionId: String?) =
                        transactionId(JsonField.ofNullable(transactionId))

                    /**
                     * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`.
                     */
                    fun transactionId(transactionId: Optional<String>) =
                        transactionId(transactionId.getOrNull())

                    /**
                     * Sets [Builder.transactionId] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.transactionId] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun transactionId(transactionId: JsonField<String>) = apply {
                        this.transactionId = transactionId
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [NetworkIdentifiers].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .authorizationIdentificationResponse()
                     * .retrievalReferenceNumber()
                     * .traceNumber()
                     * .transactionId()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): NetworkIdentifiers =
                        NetworkIdentifiers(
                            checkRequired(
                                "authorizationIdentificationResponse",
                                authorizationIdentificationResponse,
                            ),
                            checkRequired("retrievalReferenceNumber", retrievalReferenceNumber),
                            checkRequired("traceNumber", traceNumber),
                            checkRequired("transactionId", transactionId),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): NetworkIdentifiers = apply {
                    if (validated) {
                        return@apply
                    }

                    authorizationIdentificationResponse()
                    retrievalReferenceNumber()
                    traceNumber()
                    transactionId()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) +
                        (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) +
                        (if (traceNumber.asKnown().isPresent) 1 else 0) +
                        (if (transactionId.asKnown().isPresent) 1 else 0)

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is NetworkIdentifiers &&
                        authorizationIdentificationResponse ==
                            other.authorizationIdentificationResponse &&
                        retrievalReferenceNumber == other.retrievalReferenceNumber &&
                        traceNumber == other.traceNumber &&
                        transactionId == other.transactionId &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        authorizationIdentificationResponse,
                        retrievalReferenceNumber,
                        traceNumber,
                        transactionId,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}"
            }

            class SchemeFee
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val amount: JsonField<String>,
                private val createdAt: JsonField<OffsetDateTime>,
                private val currency: JsonField<Currency>,
                private val feeType: JsonField<FeeType>,
                private val fixedComponent: JsonField<String>,
                private val variableRate: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("amount")
                    @ExcludeMissing
                    amount: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("created_at")
                    @ExcludeMissing
                    createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                    @JsonProperty("currency")
                    @ExcludeMissing
                    currency: JsonField<Currency> = JsonMissing.of(),
                    @JsonProperty("fee_type")
                    @ExcludeMissing
                    feeType: JsonField<FeeType> = JsonMissing.of(),
                    @JsonProperty("fixed_component")
                    @ExcludeMissing
                    fixedComponent: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("variable_rate")
                    @ExcludeMissing
                    variableRate: JsonField<String> = JsonMissing.of(),
                ) : this(
                    amount,
                    createdAt,
                    currency,
                    feeType,
                    fixedComponent,
                    variableRate,
                    mutableMapOf(),
                )

                /**
                 * The fee amount given as a string containing a decimal number.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun amount(): String = amount.getRequired("amount")

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was
                 * created.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /**
                 * The type of fee being assessed.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun feeType(): FeeType = feeType.getRequired("fee_type")

                /**
                 * The fixed component of the fee, if applicable, given in major units of the fee
                 * amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun fixedComponent(): Optional<String> =
                    fixedComponent.getOptional("fixed_component")

                /**
                 * The variable rate component of the fee, if applicable, given as a decimal (e.g.,
                 * 0.015 for 1.5%).
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun variableRate(): Optional<String> = variableRate.getOptional("variable_rate")

                /**
                 * Returns the raw JSON value of [amount].
                 *
                 * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<String> = amount

                /**
                 * Returns the raw JSON value of [createdAt].
                 *
                 * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("created_at")
                @ExcludeMissing
                fun _createdAt(): JsonField<OffsetDateTime> = createdAt

                /**
                 * Returns the raw JSON value of [currency].
                 *
                 * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun _currency(): JsonField<Currency> = currency

                /**
                 * Returns the raw JSON value of [feeType].
                 *
                 * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("fee_type")
                @ExcludeMissing
                fun _feeType(): JsonField<FeeType> = feeType

                /**
                 * Returns the raw JSON value of [fixedComponent].
                 *
                 * Unlike [fixedComponent], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("fixed_component")
                @ExcludeMissing
                fun _fixedComponent(): JsonField<String> = fixedComponent

                /**
                 * Returns the raw JSON value of [variableRate].
                 *
                 * Unlike [variableRate], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("variable_rate")
                @ExcludeMissing
                fun _variableRate(): JsonField<String> = variableRate

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [SchemeFee].
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [SchemeFee]. */
                class Builder internal constructor() {

                    private var amount: JsonField<String>? = null
                    private var createdAt: JsonField<OffsetDateTime>? = null
                    private var currency: JsonField<Currency>? = null
                    private var feeType: JsonField<FeeType>? = null
                    private var fixedComponent: JsonField<String>? = null
                    private var variableRate: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(schemeFee: SchemeFee) = apply {
                        amount = schemeFee.amount
                        createdAt = schemeFee.createdAt
                        currency = schemeFee.currency
                        feeType = schemeFee.feeType
                        fixedComponent = schemeFee.fixedComponent
                        variableRate = schemeFee.variableRate
                        additionalProperties = schemeFee.additionalProperties.toMutableMap()
                    }

                    /** The fee amount given as a string containing a decimal number. */
                    fun amount(amount: String) = amount(JsonField.of(amount))

                    /**
                     * Sets [Builder.amount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.amount] with a well-typed [String] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun amount(amount: JsonField<String>) = apply { this.amount = amount }

                    /**
                     * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee
                     * was created.
                     */
                    fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt))

                    /**
                     * Sets [Builder.createdAt] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.createdAt] with a well-typed
                     * [OffsetDateTime] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply {
                        this.createdAt = createdAt
                    }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                     * reimbursement.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * Sets [Builder.currency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.currency] with a well-typed [Currency] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                    /** The type of fee being assessed. */
                    fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType))

                    /**
                     * Sets [Builder.feeType] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.feeType] with a well-typed [FeeType] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun feeType(feeType: JsonField<FeeType>) = apply { this.feeType = feeType }

                    /**
                     * The fixed component of the fee, if applicable, given in major units of the
                     * fee amount.
                     */
                    fun fixedComponent(fixedComponent: String?) =
                        fixedComponent(JsonField.ofNullable(fixedComponent))

                    /**
                     * Alias for calling [Builder.fixedComponent] with
                     * `fixedComponent.orElse(null)`.
                     */
                    fun fixedComponent(fixedComponent: Optional<String>) =
                        fixedComponent(fixedComponent.getOrNull())

                    /**
                     * Sets [Builder.fixedComponent] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.fixedComponent] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun fixedComponent(fixedComponent: JsonField<String>) = apply {
                        this.fixedComponent = fixedComponent
                    }

                    /**
                     * The variable rate component of the fee, if applicable, given as a decimal
                     * (e.g., 0.015 for 1.5%).
                     */
                    fun variableRate(variableRate: String?) =
                        variableRate(JsonField.ofNullable(variableRate))

                    /**
                     * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`.
                     */
                    fun variableRate(variableRate: Optional<String>) =
                        variableRate(variableRate.getOrNull())

                    /**
                     * Sets [Builder.variableRate] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.variableRate] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun variableRate(variableRate: JsonField<String>) = apply {
                        this.variableRate = variableRate
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [SchemeFee].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): SchemeFee =
                        SchemeFee(
                            checkRequired("amount", amount),
                            checkRequired("createdAt", createdAt),
                            checkRequired("currency", currency),
                            checkRequired("feeType", feeType),
                            checkRequired("fixedComponent", fixedComponent),
                            checkRequired("variableRate", variableRate),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): SchemeFee = apply {
                    if (validated) {
                        return@apply
                    }

                    amount()
                    createdAt()
                    currency().validate()
                    feeType().validate()
                    fixedComponent()
                    variableRate()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (amount.asKnown().isPresent) 1 else 0) +
                        (if (createdAt.asKnown().isPresent) 1 else 0) +
                        (currency.asKnown().getOrNull()?.validity() ?: 0) +
                        (feeType.asKnown().getOrNull()?.validity() ?: 0) +
                        (if (fixedComponent.asKnown().isPresent) 1 else 0) +
                        (if (variableRate.asKnown().isPresent) 1 else 0)

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 */
                class Currency
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** US Dollar (USD) */
                        @JvmField val USD = of("USD")

                        @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                    }

                    /** An enum containing [Currency]'s known values. */
                    enum class Known {
                        /** US Dollar (USD) */
                        USD
                    }

                    /**
                     * An enum containing [Currency]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Currency] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** US Dollar (USD) */
                        USD,
                        /**
                         * An enum member indicating that [Currency] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            USD -> Value.USD
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            USD -> Known.USD
                            else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Currency = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Currency && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** The type of fee being assessed. */
                class FeeType
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY =
                            of("visa_international_service_assessment_single_currency")

                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY =
                            of("visa_international_service_assessment_cross_currency")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE =
                            of("visa_authorization_domestic_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_international_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE =
                            of("visa_authorization_canada_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_international_point_of_sale")

                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE =
                            of("visa_authorization_address_verification_service")

                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        @JvmField
                        val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization")

                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission")

                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_DOMESTIC =
                            of("visa_account_verification_domestic")

                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL =
                            of("visa_account_verification_international")

                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_CANADA =
                            of("visa_account_verification_canada")

                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee")

                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        @JvmField
                        val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE =
                            of("visa_consumer_debit_acceptance_fee")

                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        @JvmField
                        val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE =
                            of("visa_business_debit_acceptance_fee")

                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee")

                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic")

                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        @JvmField
                        val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international")

                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token")

                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token")

                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission")

                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization")

                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        @JvmField
                        val VISA_DIRECT_TRANSACTION_DOMESTIC =
                            of("visa_direct_transaction_domestic")

                        /** Issuer card service fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit")

                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT =
                            of("visa_advertising_service_commercial_credit")

                        /** Issuer Community Growth Acceleration Program Fee. */
                        @JvmField
                        val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM =
                            of("visa_community_growth_acceleration_program")

                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        @JvmField
                        val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT =
                            of("visa_processing_guarantee_commercial_credit")

                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee")

                        @JvmStatic fun of(value: String) = FeeType(JsonField.of(value))
                    }

                    /** An enum containing [FeeType]'s known values. */
                    enum class Known {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                    }

                    /**
                     * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member.
                     *
                     * An instance of [FeeType] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                        /**
                         * An enum member indicating that [FeeType] was instantiated with an unknown
                         * value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Value.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Value.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Known.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Known.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE
                            else -> throw IncreaseInvalidDataException("Unknown FeeType: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): FeeType = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is FeeType && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is SchemeFee &&
                        amount == other.amount &&
                        createdAt == other.createdAt &&
                        currency == other.currency &&
                        feeType == other.feeType &&
                        fixedComponent == other.fixedComponent &&
                        variableRate == other.variableRate &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        amount,
                        createdAt,
                        currency,
                        feeType,
                        fixedComponent,
                        variableRate,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}"
            }

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_fuel_confirmation`.
             */
            class Type @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    @JvmField val CARD_FUEL_CONFIRMATION = of("card_fuel_confirmation")

                    @JvmStatic fun of(value: String) = Type(JsonField.of(value))
                }

                /** An enum containing [Type]'s known values. */
                enum class Known {
                    CARD_FUEL_CONFIRMATION
                }

                /**
                 * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Type] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    CARD_FUEL_CONFIRMATION,
                    /**
                     * An enum member indicating that [Type] was instantiated with an unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        CARD_FUEL_CONFIRMATION -> Value.CARD_FUEL_CONFIRMATION
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        CARD_FUEL_CONFIRMATION -> Known.CARD_FUEL_CONFIRMATION
                        else -> throw IncreaseInvalidDataException("Unknown Type: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Type = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Type && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            override fun equals(other: Any?): Boolean {
                if (this === other) {
                    return true
                }

                return other is CardFuelConfirmation &&
                    id == other.id &&
                    cardAuthorizationId == other.cardAuthorizationId &&
                    currency == other.currency &&
                    network == other.network &&
                    networkIdentifiers == other.networkIdentifiers &&
                    pendingTransactionId == other.pendingTransactionId &&
                    schemeFees == other.schemeFees &&
                    type == other.type &&
                    updatedAuthorizationAmount == other.updatedAuthorizationAmount &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    id,
                    cardAuthorizationId,
                    currency,
                    network,
                    networkIdentifiers,
                    pendingTransactionId,
                    schemeFees,
                    type,
                    updatedAuthorizationAmount,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardFuelConfirmation{id=$id, cardAuthorizationId=$cardAuthorizationId, currency=$currency, network=$network, networkIdentifiers=$networkIdentifiers, pendingTransactionId=$pendingTransactionId, schemeFees=$schemeFees, type=$type, updatedAuthorizationAmount=$updatedAuthorizationAmount, additionalProperties=$additionalProperties}"
        }

        /**
         * A Card Increment object. This field will be present in the JSON response if and only if
         * `category` is equal to `card_increment`. Card Increments increase the pending amount of
         * an authorized transaction.
         */
        class CardIncrement
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val id: JsonField<String>,
            private val actioner: JsonField<Actioner>,
            private val additionalAmounts: JsonField<AdditionalAmounts>,
            private val amount: JsonField<Long>,
            private val cardAuthorizationId: JsonField<String>,
            private val currency: JsonField<Currency>,
            private val network: JsonField<Network>,
            private val networkIdentifiers: JsonField<NetworkIdentifiers>,
            private val networkRiskScore: JsonField<Long>,
            private val pendingTransactionId: JsonField<String>,
            private val presentmentAmount: JsonField<Long>,
            private val presentmentCurrency: JsonField<String>,
            private val realTimeDecisionId: JsonField<String>,
            private val schemeFees: JsonField<List<SchemeFee>>,
            private val type: JsonField<Type>,
            private val updatedAuthorizationAmount: JsonField<Long>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
                @JsonProperty("actioner")
                @ExcludeMissing
                actioner: JsonField<Actioner> = JsonMissing.of(),
                @JsonProperty("additional_amounts")
                @ExcludeMissing
                additionalAmounts: JsonField<AdditionalAmounts> = JsonMissing.of(),
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("card_authorization_id")
                @ExcludeMissing
                cardAuthorizationId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("network")
                @ExcludeMissing
                network: JsonField<Network> = JsonMissing.of(),
                @JsonProperty("network_identifiers")
                @ExcludeMissing
                networkIdentifiers: JsonField<NetworkIdentifiers> = JsonMissing.of(),
                @JsonProperty("network_risk_score")
                @ExcludeMissing
                networkRiskScore: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("pending_transaction_id")
                @ExcludeMissing
                pendingTransactionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("presentment_amount")
                @ExcludeMissing
                presentmentAmount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("presentment_currency")
                @ExcludeMissing
                presentmentCurrency: JsonField<String> = JsonMissing.of(),
                @JsonProperty("real_time_decision_id")
                @ExcludeMissing
                realTimeDecisionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("scheme_fees")
                @ExcludeMissing
                schemeFees: JsonField<List<SchemeFee>> = JsonMissing.of(),
                @JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
                @JsonProperty("updated_authorization_amount")
                @ExcludeMissing
                updatedAuthorizationAmount: JsonField<Long> = JsonMissing.of(),
            ) : this(
                id,
                actioner,
                additionalAmounts,
                amount,
                cardAuthorizationId,
                currency,
                network,
                networkIdentifiers,
                networkRiskScore,
                pendingTransactionId,
                presentmentAmount,
                presentmentCurrency,
                realTimeDecisionId,
                schemeFees,
                type,
                updatedAuthorizationAmount,
                mutableMapOf(),
            )

            /**
             * The Card Increment identifier.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun id(): String = id.getRequired("id")

            /**
             * Whether this authorization was approved by Increase, the card network through
             * stand-in processing, or the user through a real-time decision.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun actioner(): Actioner = actioner.getRequired("actioner")

            /**
             * Additional amounts associated with the card authorization, such as ATM surcharges
             * fees. These are usually a subset of the `amount` field and are used to provide more
             * detailed information about the transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun additionalAmounts(): AdditionalAmounts =
                additionalAmounts.getRequired("additional_amounts")

            /**
             * The amount of this increment in the minor unit of the transaction's currency. For
             * dollars, for example, this is cents.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun amount(): Long = amount.getRequired("amount")

            /**
             * The identifier for the Card Authorization this increments.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun cardAuthorizationId(): String =
                cardAuthorizationId.getRequired("card_authorization_id")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's
             * currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun currency(): Currency = currency.getRequired("currency")

            /**
             * The card network used to process this card authorization.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun network(): Network = network.getRequired("network")

            /**
             * Network-specific identifiers for a specific request or transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun networkIdentifiers(): NetworkIdentifiers =
                networkIdentifiers.getRequired("network_identifiers")

            /**
             * The risk score generated by the card network. For Visa this is the Visa Advanced
             * Authorization risk score, from 0 to 99, where 99 is the riskiest.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun networkRiskScore(): Optional<Long> =
                networkRiskScore.getOptional("network_risk_score")

            /**
             * The identifier of the Pending Transaction associated with this Card Increment.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun pendingTransactionId(): Optional<String> =
                pendingTransactionId.getOptional("pending_transaction_id")

            /**
             * The amount of this increment in the minor unit of the transaction's presentment
             * currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun presentmentAmount(): Long = presentmentAmount.getRequired("presentment_amount")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
             * presentment currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun presentmentCurrency(): String =
                presentmentCurrency.getRequired("presentment_currency")

            /**
             * The identifier of the Real-Time Decision sent to approve or decline this incremental
             * authorization.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun realTimeDecisionId(): Optional<String> =
                realTimeDecisionId.getOptional("real_time_decision_id")

            /**
             * The scheme fees associated with this card increment.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun schemeFees(): List<SchemeFee> = schemeFees.getRequired("scheme_fees")

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_increment`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun type(): Type = type.getRequired("type")

            /**
             * The updated authorization amount after this increment, in the minor unit of the
             * transaction's currency. For dollars, for example, this is cents.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun updatedAuthorizationAmount(): Long =
                updatedAuthorizationAmount.getRequired("updated_authorization_amount")

            /**
             * Returns the raw JSON value of [id].
             *
             * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id

            /**
             * Returns the raw JSON value of [actioner].
             *
             * Unlike [actioner], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("actioner")
            @ExcludeMissing
            fun _actioner(): JsonField<Actioner> = actioner

            /**
             * Returns the raw JSON value of [additionalAmounts].
             *
             * Unlike [additionalAmounts], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("additional_amounts")
            @ExcludeMissing
            fun _additionalAmounts(): JsonField<AdditionalAmounts> = additionalAmounts

            /**
             * Returns the raw JSON value of [amount].
             *
             * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

            /**
             * Returns the raw JSON value of [cardAuthorizationId].
             *
             * Unlike [cardAuthorizationId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("card_authorization_id")
            @ExcludeMissing
            fun _cardAuthorizationId(): JsonField<String> = cardAuthorizationId

            /**
             * Returns the raw JSON value of [currency].
             *
             * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("currency")
            @ExcludeMissing
            fun _currency(): JsonField<Currency> = currency

            /**
             * Returns the raw JSON value of [network].
             *
             * Unlike [network], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("network") @ExcludeMissing fun _network(): JsonField<Network> = network

            /**
             * Returns the raw JSON value of [networkIdentifiers].
             *
             * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_identifiers")
            @ExcludeMissing
            fun _networkIdentifiers(): JsonField<NetworkIdentifiers> = networkIdentifiers

            /**
             * Returns the raw JSON value of [networkRiskScore].
             *
             * Unlike [networkRiskScore], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_risk_score")
            @ExcludeMissing
            fun _networkRiskScore(): JsonField<Long> = networkRiskScore

            /**
             * Returns the raw JSON value of [pendingTransactionId].
             *
             * Unlike [pendingTransactionId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("pending_transaction_id")
            @ExcludeMissing
            fun _pendingTransactionId(): JsonField<String> = pendingTransactionId

            /**
             * Returns the raw JSON value of [presentmentAmount].
             *
             * Unlike [presentmentAmount], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("presentment_amount")
            @ExcludeMissing
            fun _presentmentAmount(): JsonField<Long> = presentmentAmount

            /**
             * Returns the raw JSON value of [presentmentCurrency].
             *
             * Unlike [presentmentCurrency], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("presentment_currency")
            @ExcludeMissing
            fun _presentmentCurrency(): JsonField<String> = presentmentCurrency

            /**
             * Returns the raw JSON value of [realTimeDecisionId].
             *
             * Unlike [realTimeDecisionId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("real_time_decision_id")
            @ExcludeMissing
            fun _realTimeDecisionId(): JsonField<String> = realTimeDecisionId

            /**
             * Returns the raw JSON value of [schemeFees].
             *
             * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("scheme_fees")
            @ExcludeMissing
            fun _schemeFees(): JsonField<List<SchemeFee>> = schemeFees

            /**
             * Returns the raw JSON value of [type].
             *
             * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("type") @ExcludeMissing fun _type(): JsonField<Type> = type

            /**
             * Returns the raw JSON value of [updatedAuthorizationAmount].
             *
             * Unlike [updatedAuthorizationAmount], this method doesn't throw if the JSON field has
             * an unexpected type.
             */
            @JsonProperty("updated_authorization_amount")
            @ExcludeMissing
            fun _updatedAuthorizationAmount(): JsonField<Long> = updatedAuthorizationAmount

            @JsonAnySetter
            private fun putAdditionalProperty(key: String, value: JsonValue) {
                additionalProperties.put(key, value)
            }

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map<String, JsonValue> =
                Collections.unmodifiableMap(additionalProperties)

            fun toBuilder() = Builder().from(this)

            companion object {

                /**
                 * Returns a mutable builder for constructing an instance of [CardIncrement].
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .actioner()
                 * .additionalAmounts()
                 * .amount()
                 * .cardAuthorizationId()
                 * .currency()
                 * .network()
                 * .networkIdentifiers()
                 * .networkRiskScore()
                 * .pendingTransactionId()
                 * .presentmentAmount()
                 * .presentmentCurrency()
                 * .realTimeDecisionId()
                 * .schemeFees()
                 * .type()
                 * .updatedAuthorizationAmount()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

            /** A builder for [CardIncrement]. */
            class Builder internal constructor() {

                private var id: JsonField<String>? = null
                private var actioner: JsonField<Actioner>? = null
                private var additionalAmounts: JsonField<AdditionalAmounts>? = null
                private var amount: JsonField<Long>? = null
                private var cardAuthorizationId: JsonField<String>? = null
                private var currency: JsonField<Currency>? = null
                private var network: JsonField<Network>? = null
                private var networkIdentifiers: JsonField<NetworkIdentifiers>? = null
                private var networkRiskScore: JsonField<Long>? = null
                private var pendingTransactionId: JsonField<String>? = null
                private var presentmentAmount: JsonField<Long>? = null
                private var presentmentCurrency: JsonField<String>? = null
                private var realTimeDecisionId: JsonField<String>? = null
                private var schemeFees: JsonField<MutableList<SchemeFee>>? = null
                private var type: JsonField<Type>? = null
                private var updatedAuthorizationAmount: JsonField<Long>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardIncrement: CardIncrement) = apply {
                    id = cardIncrement.id
                    actioner = cardIncrement.actioner
                    additionalAmounts = cardIncrement.additionalAmounts
                    amount = cardIncrement.amount
                    cardAuthorizationId = cardIncrement.cardAuthorizationId
                    currency = cardIncrement.currency
                    network = cardIncrement.network
                    networkIdentifiers = cardIncrement.networkIdentifiers
                    networkRiskScore = cardIncrement.networkRiskScore
                    pendingTransactionId = cardIncrement.pendingTransactionId
                    presentmentAmount = cardIncrement.presentmentAmount
                    presentmentCurrency = cardIncrement.presentmentCurrency
                    realTimeDecisionId = cardIncrement.realTimeDecisionId
                    schemeFees = cardIncrement.schemeFees.map { it.toMutableList() }
                    type = cardIncrement.type
                    updatedAuthorizationAmount = cardIncrement.updatedAuthorizationAmount
                    additionalProperties = cardIncrement.additionalProperties.toMutableMap()
                }

                /** The Card Increment identifier. */
                fun id(id: String) = id(JsonField.of(id))

                /**
                 * Sets [Builder.id] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.id] with a well-typed [String] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun id(id: JsonField<String>) = apply { this.id = id }

                /**
                 * Whether this authorization was approved by Increase, the card network through
                 * stand-in processing, or the user through a real-time decision.
                 */
                fun actioner(actioner: Actioner) = actioner(JsonField.of(actioner))

                /**
                 * Sets [Builder.actioner] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.actioner] with a well-typed [Actioner] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun actioner(actioner: JsonField<Actioner>) = apply { this.actioner = actioner }

                /**
                 * Additional amounts associated with the card authorization, such as ATM surcharges
                 * fees. These are usually a subset of the `amount` field and are used to provide
                 * more detailed information about the transaction.
                 */
                fun additionalAmounts(additionalAmounts: AdditionalAmounts) =
                    additionalAmounts(JsonField.of(additionalAmounts))

                /**
                 * Sets [Builder.additionalAmounts] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.additionalAmounts] with a well-typed
                 * [AdditionalAmounts] value instead. This method is primarily for setting the field
                 * to an undocumented or not yet supported value.
                 */
                fun additionalAmounts(additionalAmounts: JsonField<AdditionalAmounts>) = apply {
                    this.additionalAmounts = additionalAmounts
                }

                /**
                 * The amount of this increment in the minor unit of the transaction's currency. For
                 * dollars, for example, this is cents.
                 */
                fun amount(amount: Long) = amount(JsonField.of(amount))

                /**
                 * Sets [Builder.amount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.amount] with a well-typed [Long] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                /** The identifier for the Card Authorization this increments. */
                fun cardAuthorizationId(cardAuthorizationId: String) =
                    cardAuthorizationId(JsonField.of(cardAuthorizationId))

                /**
                 * Sets [Builder.cardAuthorizationId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cardAuthorizationId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun cardAuthorizationId(cardAuthorizationId: JsonField<String>) = apply {
                    this.cardAuthorizationId = cardAuthorizationId
                }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's
                 * currency.
                 */
                fun currency(currency: Currency) = currency(JsonField.of(currency))

                /**
                 * Sets [Builder.currency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.currency] with a well-typed [Currency] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                /** The card network used to process this card authorization. */
                fun network(network: Network) = network(JsonField.of(network))

                /**
                 * Sets [Builder.network] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.network] with a well-typed [Network] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun network(network: JsonField<Network>) = apply { this.network = network }

                /** Network-specific identifiers for a specific request or transaction. */
                fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) =
                    networkIdentifiers(JsonField.of(networkIdentifiers))

                /**
                 * Sets [Builder.networkIdentifiers] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkIdentifiers] with a well-typed
                 * [NetworkIdentifiers] value instead. This method is primarily for setting the
                 * field to an undocumented or not yet supported value.
                 */
                fun networkIdentifiers(networkIdentifiers: JsonField<NetworkIdentifiers>) = apply {
                    this.networkIdentifiers = networkIdentifiers
                }

                /**
                 * The risk score generated by the card network. For Visa this is the Visa Advanced
                 * Authorization risk score, from 0 to 99, where 99 is the riskiest.
                 */
                fun networkRiskScore(networkRiskScore: Long?) =
                    networkRiskScore(JsonField.ofNullable(networkRiskScore))

                /**
                 * Alias for [Builder.networkRiskScore].
                 *
                 * This unboxed primitive overload exists for backwards compatibility.
                 */
                fun networkRiskScore(networkRiskScore: Long) =
                    networkRiskScore(networkRiskScore as Long?)

                /**
                 * Alias for calling [Builder.networkRiskScore] with
                 * `networkRiskScore.orElse(null)`.
                 */
                fun networkRiskScore(networkRiskScore: Optional<Long>) =
                    networkRiskScore(networkRiskScore.getOrNull())

                /**
                 * Sets [Builder.networkRiskScore] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkRiskScore] with a well-typed [Long] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun networkRiskScore(networkRiskScore: JsonField<Long>) = apply {
                    this.networkRiskScore = networkRiskScore
                }

                /**
                 * The identifier of the Pending Transaction associated with this Card Increment.
                 */
                fun pendingTransactionId(pendingTransactionId: String?) =
                    pendingTransactionId(JsonField.ofNullable(pendingTransactionId))

                /**
                 * Alias for calling [Builder.pendingTransactionId] with
                 * `pendingTransactionId.orElse(null)`.
                 */
                fun pendingTransactionId(pendingTransactionId: Optional<String>) =
                    pendingTransactionId(pendingTransactionId.getOrNull())

                /**
                 * Sets [Builder.pendingTransactionId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.pendingTransactionId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun pendingTransactionId(pendingTransactionId: JsonField<String>) = apply {
                    this.pendingTransactionId = pendingTransactionId
                }

                /**
                 * The amount of this increment in the minor unit of the transaction's presentment
                 * currency.
                 */
                fun presentmentAmount(presentmentAmount: Long) =
                    presentmentAmount(JsonField.of(presentmentAmount))

                /**
                 * Sets [Builder.presentmentAmount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.presentmentAmount] with a well-typed [Long]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun presentmentAmount(presentmentAmount: JsonField<Long>) = apply {
                    this.presentmentAmount = presentmentAmount
                }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
                 * presentment currency.
                 */
                fun presentmentCurrency(presentmentCurrency: String) =
                    presentmentCurrency(JsonField.of(presentmentCurrency))

                /**
                 * Sets [Builder.presentmentCurrency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.presentmentCurrency] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun presentmentCurrency(presentmentCurrency: JsonField<String>) = apply {
                    this.presentmentCurrency = presentmentCurrency
                }

                /**
                 * The identifier of the Real-Time Decision sent to approve or decline this
                 * incremental authorization.
                 */
                fun realTimeDecisionId(realTimeDecisionId: String?) =
                    realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId))

                /**
                 * Alias for calling [Builder.realTimeDecisionId] with
                 * `realTimeDecisionId.orElse(null)`.
                 */
                fun realTimeDecisionId(realTimeDecisionId: Optional<String>) =
                    realTimeDecisionId(realTimeDecisionId.getOrNull())

                /**
                 * Sets [Builder.realTimeDecisionId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.realTimeDecisionId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun realTimeDecisionId(realTimeDecisionId: JsonField<String>) = apply {
                    this.realTimeDecisionId = realTimeDecisionId
                }

                /** The scheme fees associated with this card increment. */
                fun schemeFees(schemeFees: List<SchemeFee>) = schemeFees(JsonField.of(schemeFees))

                /**
                 * Sets [Builder.schemeFees] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.schemeFees] with a well-typed `List<SchemeFee>`
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun schemeFees(schemeFees: JsonField<List<SchemeFee>>) = apply {
                    this.schemeFees = schemeFees.map { it.toMutableList() }
                }

                /**
                 * Adds a single [SchemeFee] to [schemeFees].
                 *
                 * @throws IllegalStateException if the field was previously set to a non-list.
                 */
                fun addSchemeFee(schemeFee: SchemeFee) = apply {
                    schemeFees =
                        (schemeFees ?: JsonField.of(mutableListOf())).also {
                            checkKnown("schemeFees", it).add(schemeFee)
                        }
                }

                /**
                 * A constant representing the object's type. For this resource it will always be
                 * `card_increment`.
                 */
                fun type(type: Type) = type(JsonField.of(type))

                /**
                 * Sets [Builder.type] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.type] with a well-typed [Type] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun type(type: JsonField<Type>) = apply { this.type = type }

                /**
                 * The updated authorization amount after this increment, in the minor unit of the
                 * transaction's currency. For dollars, for example, this is cents.
                 */
                fun updatedAuthorizationAmount(updatedAuthorizationAmount: Long) =
                    updatedAuthorizationAmount(JsonField.of(updatedAuthorizationAmount))

                /**
                 * Sets [Builder.updatedAuthorizationAmount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.updatedAuthorizationAmount] with a well-typed
                 * [Long] value instead. This method is primarily for setting the field to an
                 * undocumented or not yet supported value.
                 */
                fun updatedAuthorizationAmount(updatedAuthorizationAmount: JsonField<Long>) =
                    apply {
                        this.updatedAuthorizationAmount = updatedAuthorizationAmount
                    }

                fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                    this.additionalProperties.clear()
                    putAllAdditionalProperties(additionalProperties)
                }

                fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                    additionalProperties.put(key, value)
                }

                fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun removeAdditionalProperty(key: String) = apply {
                    additionalProperties.remove(key)
                }

                fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                    keys.forEach(::removeAdditionalProperty)
                }

                /**
                 * Returns an immutable instance of [CardIncrement].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .actioner()
                 * .additionalAmounts()
                 * .amount()
                 * .cardAuthorizationId()
                 * .currency()
                 * .network()
                 * .networkIdentifiers()
                 * .networkRiskScore()
                 * .pendingTransactionId()
                 * .presentmentAmount()
                 * .presentmentCurrency()
                 * .realTimeDecisionId()
                 * .schemeFees()
                 * .type()
                 * .updatedAuthorizationAmount()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardIncrement =
                    CardIncrement(
                        checkRequired("id", id),
                        checkRequired("actioner", actioner),
                        checkRequired("additionalAmounts", additionalAmounts),
                        checkRequired("amount", amount),
                        checkRequired("cardAuthorizationId", cardAuthorizationId),
                        checkRequired("currency", currency),
                        checkRequired("network", network),
                        checkRequired("networkIdentifiers", networkIdentifiers),
                        checkRequired("networkRiskScore", networkRiskScore),
                        checkRequired("pendingTransactionId", pendingTransactionId),
                        checkRequired("presentmentAmount", presentmentAmount),
                        checkRequired("presentmentCurrency", presentmentCurrency),
                        checkRequired("realTimeDecisionId", realTimeDecisionId),
                        checkRequired("schemeFees", schemeFees).map { it.toImmutable() },
                        checkRequired("type", type),
                        checkRequired("updatedAuthorizationAmount", updatedAuthorizationAmount),
                        additionalProperties.toMutableMap(),
                    )
            }

            private var validated: Boolean = false

            /**
             * Validates that the types of all values in this object match their expected types
             * recursively.
             *
             * This method is _not_ forwards compatible with new types from the API for existing
             * fields.
             *
             * @throws IncreaseInvalidDataException if any value type in this object doesn't match
             *   its expected type.
             */
            fun validate(): CardIncrement = apply {
                if (validated) {
                    return@apply
                }

                id()
                actioner().validate()
                additionalAmounts().validate()
                amount()
                cardAuthorizationId()
                currency().validate()
                network().validate()
                networkIdentifiers().validate()
                networkRiskScore()
                pendingTransactionId()
                presentmentAmount()
                presentmentCurrency()
                realTimeDecisionId()
                schemeFees().forEach { it.validate() }
                type().validate()
                updatedAuthorizationAmount()
                validated = true
            }

            fun isValid(): Boolean =
                try {
                    validate()
                    true
                } catch (e: IncreaseInvalidDataException) {
                    false
                }

            /**
             * Returns a score indicating how many valid values are contained in this object
             * recursively.
             *
             * Used for best match union deserialization.
             */
            @JvmSynthetic
            internal fun validity(): Int =
                (if (id.asKnown().isPresent) 1 else 0) +
                    (actioner.asKnown().getOrNull()?.validity() ?: 0) +
                    (additionalAmounts.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (amount.asKnown().isPresent) 1 else 0) +
                    (if (cardAuthorizationId.asKnown().isPresent) 1 else 0) +
                    (currency.asKnown().getOrNull()?.validity() ?: 0) +
                    (network.asKnown().getOrNull()?.validity() ?: 0) +
                    (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (networkRiskScore.asKnown().isPresent) 1 else 0) +
                    (if (pendingTransactionId.asKnown().isPresent) 1 else 0) +
                    (if (presentmentAmount.asKnown().isPresent) 1 else 0) +
                    (if (presentmentCurrency.asKnown().isPresent) 1 else 0) +
                    (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) +
                    (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
                    (type.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (updatedAuthorizationAmount.asKnown().isPresent) 1 else 0)

            /**
             * Whether this authorization was approved by Increase, the card network through
             * stand-in processing, or the user through a real-time decision.
             */
            class Actioner @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** This object was actioned by the user through a real-time decision. */
                    @JvmField val USER = of("user")

                    /** This object was actioned by Increase without user intervention. */
                    @JvmField val INCREASE = of("increase")

                    /** This object was actioned by the network, through stand-in processing. */
                    @JvmField val NETWORK = of("network")

                    @JvmStatic fun of(value: String) = Actioner(JsonField.of(value))
                }

                /** An enum containing [Actioner]'s known values. */
                enum class Known {
                    /** This object was actioned by the user through a real-time decision. */
                    USER,
                    /** This object was actioned by Increase without user intervention. */
                    INCREASE,
                    /** This object was actioned by the network, through stand-in processing. */
                    NETWORK,
                }

                /**
                 * An enum containing [Actioner]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Actioner] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** This object was actioned by the user through a real-time decision. */
                    USER,
                    /** This object was actioned by Increase without user intervention. */
                    INCREASE,
                    /** This object was actioned by the network, through stand-in processing. */
                    NETWORK,
                    /**
                     * An enum member indicating that [Actioner] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        USER -> Value.USER
                        INCREASE -> Value.INCREASE
                        NETWORK -> Value.NETWORK
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        USER -> Known.USER
                        INCREASE -> Known.INCREASE
                        NETWORK -> Known.NETWORK
                        else -> throw IncreaseInvalidDataException("Unknown Actioner: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Actioner = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Actioner && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /**
             * Additional amounts associated with the card authorization, such as ATM surcharges
             * fees. These are usually a subset of the `amount` field and are used to provide more
             * detailed information about the transaction.
             */
            class AdditionalAmounts
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val clinic: JsonField<Clinic>,
                private val dental: JsonField<Dental>,
                private val original: JsonField<Original>,
                private val prescription: JsonField<Prescription>,
                private val surcharge: JsonField<Surcharge>,
                private val totalCumulative: JsonField<TotalCumulative>,
                private val totalHealthcare: JsonField<TotalHealthcare>,
                private val transit: JsonField<Transit>,
                private val unknown: JsonField<Unknown>,
                private val vision: JsonField<Vision>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("clinic")
                    @ExcludeMissing
                    clinic: JsonField<Clinic> = JsonMissing.of(),
                    @JsonProperty("dental")
                    @ExcludeMissing
                    dental: JsonField<Dental> = JsonMissing.of(),
                    @JsonProperty("original")
                    @ExcludeMissing
                    original: JsonField<Original> = JsonMissing.of(),
                    @JsonProperty("prescription")
                    @ExcludeMissing
                    prescription: JsonField<Prescription> = JsonMissing.of(),
                    @JsonProperty("surcharge")
                    @ExcludeMissing
                    surcharge: JsonField<Surcharge> = JsonMissing.of(),
                    @JsonProperty("total_cumulative")
                    @ExcludeMissing
                    totalCumulative: JsonField<TotalCumulative> = JsonMissing.of(),
                    @JsonProperty("total_healthcare")
                    @ExcludeMissing
                    totalHealthcare: JsonField<TotalHealthcare> = JsonMissing.of(),
                    @JsonProperty("transit")
                    @ExcludeMissing
                    transit: JsonField<Transit> = JsonMissing.of(),
                    @JsonProperty("unknown")
                    @ExcludeMissing
                    unknown: JsonField<Unknown> = JsonMissing.of(),
                    @JsonProperty("vision")
                    @ExcludeMissing
                    vision: JsonField<Vision> = JsonMissing.of(),
                ) : this(
                    clinic,
                    dental,
                    original,
                    prescription,
                    surcharge,
                    totalCumulative,
                    totalHealthcare,
                    transit,
                    unknown,
                    vision,
                    mutableMapOf(),
                )

                /**
                 * The part of this transaction amount that was for clinic-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun clinic(): Optional<Clinic> = clinic.getOptional("clinic")

                /**
                 * The part of this transaction amount that was for dental-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun dental(): Optional<Dental> = dental.getOptional("dental")

                /**
                 * The original pre-authorized amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun original(): Optional<Original> = original.getOptional("original")

                /**
                 * The part of this transaction amount that was for healthcare prescriptions.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun prescription(): Optional<Prescription> =
                    prescription.getOptional("prescription")

                /**
                 * The surcharge amount charged for this transaction by the merchant.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun surcharge(): Optional<Surcharge> = surcharge.getOptional("surcharge")

                /**
                 * The total amount of a series of incremental authorizations, optionally provided.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun totalCumulative(): Optional<TotalCumulative> =
                    totalCumulative.getOptional("total_cumulative")

                /**
                 * The total amount of healthcare-related additional amounts.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun totalHealthcare(): Optional<TotalHealthcare> =
                    totalHealthcare.getOptional("total_healthcare")

                /**
                 * The part of this transaction amount that was for transit-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun transit(): Optional<Transit> = transit.getOptional("transit")

                /**
                 * An unknown additional amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun unknown(): Optional<Unknown> = unknown.getOptional("unknown")

                /**
                 * The part of this transaction amount that was for vision-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun vision(): Optional<Vision> = vision.getOptional("vision")

                /**
                 * Returns the raw JSON value of [clinic].
                 *
                 * Unlike [clinic], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("clinic") @ExcludeMissing fun _clinic(): JsonField<Clinic> = clinic

                /**
                 * Returns the raw JSON value of [dental].
                 *
                 * Unlike [dental], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("dental") @ExcludeMissing fun _dental(): JsonField<Dental> = dental

                /**
                 * Returns the raw JSON value of [original].
                 *
                 * Unlike [original], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("original")
                @ExcludeMissing
                fun _original(): JsonField<Original> = original

                /**
                 * Returns the raw JSON value of [prescription].
                 *
                 * Unlike [prescription], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("prescription")
                @ExcludeMissing
                fun _prescription(): JsonField<Prescription> = prescription

                /**
                 * Returns the raw JSON value of [surcharge].
                 *
                 * Unlike [surcharge], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("surcharge")
                @ExcludeMissing
                fun _surcharge(): JsonField<Surcharge> = surcharge

                /**
                 * Returns the raw JSON value of [totalCumulative].
                 *
                 * Unlike [totalCumulative], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("total_cumulative")
                @ExcludeMissing
                fun _totalCumulative(): JsonField<TotalCumulative> = totalCumulative

                /**
                 * Returns the raw JSON value of [totalHealthcare].
                 *
                 * Unlike [totalHealthcare], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("total_healthcare")
                @ExcludeMissing
                fun _totalHealthcare(): JsonField<TotalHealthcare> = totalHealthcare

                /**
                 * Returns the raw JSON value of [transit].
                 *
                 * Unlike [transit], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("transit")
                @ExcludeMissing
                fun _transit(): JsonField<Transit> = transit

                /**
                 * Returns the raw JSON value of [unknown].
                 *
                 * Unlike [unknown], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("unknown")
                @ExcludeMissing
                fun _unknown(): JsonField<Unknown> = unknown

                /**
                 * Returns the raw JSON value of [vision].
                 *
                 * Unlike [vision], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("vision") @ExcludeMissing fun _vision(): JsonField<Vision> = vision

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of
                     * [AdditionalAmounts].
                     *
                     * The following fields are required:
                     * ```java
                     * .clinic()
                     * .dental()
                     * .original()
                     * .prescription()
                     * .surcharge()
                     * .totalCumulative()
                     * .totalHealthcare()
                     * .transit()
                     * .unknown()
                     * .vision()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [AdditionalAmounts]. */
                class Builder internal constructor() {

                    private var clinic: JsonField<Clinic>? = null
                    private var dental: JsonField<Dental>? = null
                    private var original: JsonField<Original>? = null
                    private var prescription: JsonField<Prescription>? = null
                    private var surcharge: JsonField<Surcharge>? = null
                    private var totalCumulative: JsonField<TotalCumulative>? = null
                    private var totalHealthcare: JsonField<TotalHealthcare>? = null
                    private var transit: JsonField<Transit>? = null
                    private var unknown: JsonField<Unknown>? = null
                    private var vision: JsonField<Vision>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(additionalAmounts: AdditionalAmounts) = apply {
                        clinic = additionalAmounts.clinic
                        dental = additionalAmounts.dental
                        original = additionalAmounts.original
                        prescription = additionalAmounts.prescription
                        surcharge = additionalAmounts.surcharge
                        totalCumulative = additionalAmounts.totalCumulative
                        totalHealthcare = additionalAmounts.totalHealthcare
                        transit = additionalAmounts.transit
                        unknown = additionalAmounts.unknown
                        vision = additionalAmounts.vision
                        additionalProperties = additionalAmounts.additionalProperties.toMutableMap()
                    }

                    /** The part of this transaction amount that was for clinic-related services. */
                    fun clinic(clinic: Clinic?) = clinic(JsonField.ofNullable(clinic))

                    /** Alias for calling [Builder.clinic] with `clinic.orElse(null)`. */
                    fun clinic(clinic: Optional<Clinic>) = clinic(clinic.getOrNull())

                    /**
                     * Sets [Builder.clinic] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.clinic] with a well-typed [Clinic] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun clinic(clinic: JsonField<Clinic>) = apply { this.clinic = clinic }

                    /** The part of this transaction amount that was for dental-related services. */
                    fun dental(dental: Dental?) = dental(JsonField.ofNullable(dental))

                    /** Alias for calling [Builder.dental] with `dental.orElse(null)`. */
                    fun dental(dental: Optional<Dental>) = dental(dental.getOrNull())

                    /**
                     * Sets [Builder.dental] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.dental] with a well-typed [Dental] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun dental(dental: JsonField<Dental>) = apply { this.dental = dental }

                    /** The original pre-authorized amount. */
                    fun original(original: Original?) = original(JsonField.ofNullable(original))

                    /** Alias for calling [Builder.original] with `original.orElse(null)`. */
                    fun original(original: Optional<Original>) = original(original.getOrNull())

                    /**
                     * Sets [Builder.original] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.original] with a well-typed [Original] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun original(original: JsonField<Original>) = apply { this.original = original }

                    /**
                     * The part of this transaction amount that was for healthcare prescriptions.
                     */
                    fun prescription(prescription: Prescription?) =
                        prescription(JsonField.ofNullable(prescription))

                    /**
                     * Alias for calling [Builder.prescription] with `prescription.orElse(null)`.
                     */
                    fun prescription(prescription: Optional<Prescription>) =
                        prescription(prescription.getOrNull())

                    /**
                     * Sets [Builder.prescription] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.prescription] with a well-typed
                     * [Prescription] value instead. This method is primarily for setting the field
                     * to an undocumented or not yet supported value.
                     */
                    fun prescription(prescription: JsonField<Prescription>) = apply {
                        this.prescription = prescription
                    }

                    /** The surcharge amount charged for this transaction by the merchant. */
                    fun surcharge(surcharge: Surcharge?) =
                        surcharge(JsonField.ofNullable(surcharge))

                    /** Alias for calling [Builder.surcharge] with `surcharge.orElse(null)`. */
                    fun surcharge(surcharge: Optional<Surcharge>) = surcharge(surcharge.getOrNull())

                    /**
                     * Sets [Builder.surcharge] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.surcharge] with a well-typed [Surcharge]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun surcharge(surcharge: JsonField<Surcharge>) = apply {
                        this.surcharge = surcharge
                    }

                    /**
                     * The total amount of a series of incremental authorizations, optionally
                     * provided.
                     */
                    fun totalCumulative(totalCumulative: TotalCumulative?) =
                        totalCumulative(JsonField.ofNullable(totalCumulative))

                    /**
                     * Alias for calling [Builder.totalCumulative] with
                     * `totalCumulative.orElse(null)`.
                     */
                    fun totalCumulative(totalCumulative: Optional<TotalCumulative>) =
                        totalCumulative(totalCumulative.getOrNull())

                    /**
                     * Sets [Builder.totalCumulative] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.totalCumulative] with a well-typed
                     * [TotalCumulative] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun totalCumulative(totalCumulative: JsonField<TotalCumulative>) = apply {
                        this.totalCumulative = totalCumulative
                    }

                    /** The total amount of healthcare-related additional amounts. */
                    fun totalHealthcare(totalHealthcare: TotalHealthcare?) =
                        totalHealthcare(JsonField.ofNullable(totalHealthcare))

                    /**
                     * Alias for calling [Builder.totalHealthcare] with
                     * `totalHealthcare.orElse(null)`.
                     */
                    fun totalHealthcare(totalHealthcare: Optional<TotalHealthcare>) =
                        totalHealthcare(totalHealthcare.getOrNull())

                    /**
                     * Sets [Builder.totalHealthcare] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.totalHealthcare] with a well-typed
                     * [TotalHealthcare] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun totalHealthcare(totalHealthcare: JsonField<TotalHealthcare>) = apply {
                        this.totalHealthcare = totalHealthcare
                    }

                    /**
                     * The part of this transaction amount that was for transit-related services.
                     */
                    fun transit(transit: Transit?) = transit(JsonField.ofNullable(transit))

                    /** Alias for calling [Builder.transit] with `transit.orElse(null)`. */
                    fun transit(transit: Optional<Transit>) = transit(transit.getOrNull())

                    /**
                     * Sets [Builder.transit] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.transit] with a well-typed [Transit] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun transit(transit: JsonField<Transit>) = apply { this.transit = transit }

                    /** An unknown additional amount. */
                    fun unknown(unknown: Unknown?) = unknown(JsonField.ofNullable(unknown))

                    /** Alias for calling [Builder.unknown] with `unknown.orElse(null)`. */
                    fun unknown(unknown: Optional<Unknown>) = unknown(unknown.getOrNull())

                    /**
                     * Sets [Builder.unknown] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.unknown] with a well-typed [Unknown] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun unknown(unknown: JsonField<Unknown>) = apply { this.unknown = unknown }

                    /** The part of this transaction amount that was for vision-related services. */
                    fun vision(vision: Vision?) = vision(JsonField.ofNullable(vision))

                    /** Alias for calling [Builder.vision] with `vision.orElse(null)`. */
                    fun vision(vision: Optional<Vision>) = vision(vision.getOrNull())

                    /**
                     * Sets [Builder.vision] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.vision] with a well-typed [Vision] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun vision(vision: JsonField<Vision>) = apply { this.vision = vision }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [AdditionalAmounts].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .clinic()
                     * .dental()
                     * .original()
                     * .prescription()
                     * .surcharge()
                     * .totalCumulative()
                     * .totalHealthcare()
                     * .transit()
                     * .unknown()
                     * .vision()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): AdditionalAmounts =
                        AdditionalAmounts(
                            checkRequired("clinic", clinic),
                            checkRequired("dental", dental),
                            checkRequired("original", original),
                            checkRequired("prescription", prescription),
                            checkRequired("surcharge", surcharge),
                            checkRequired("totalCumulative", totalCumulative),
                            checkRequired("totalHealthcare", totalHealthcare),
                            checkRequired("transit", transit),
                            checkRequired("unknown", unknown),
                            checkRequired("vision", vision),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): AdditionalAmounts = apply {
                    if (validated) {
                        return@apply
                    }

                    clinic().ifPresent { it.validate() }
                    dental().ifPresent { it.validate() }
                    original().ifPresent { it.validate() }
                    prescription().ifPresent { it.validate() }
                    surcharge().ifPresent { it.validate() }
                    totalCumulative().ifPresent { it.validate() }
                    totalHealthcare().ifPresent { it.validate() }
                    transit().ifPresent { it.validate() }
                    unknown().ifPresent { it.validate() }
                    vision().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (clinic.asKnown().getOrNull()?.validity() ?: 0) +
                        (dental.asKnown().getOrNull()?.validity() ?: 0) +
                        (original.asKnown().getOrNull()?.validity() ?: 0) +
                        (prescription.asKnown().getOrNull()?.validity() ?: 0) +
                        (surcharge.asKnown().getOrNull()?.validity() ?: 0) +
                        (totalCumulative.asKnown().getOrNull()?.validity() ?: 0) +
                        (totalHealthcare.asKnown().getOrNull()?.validity() ?: 0) +
                        (transit.asKnown().getOrNull()?.validity() ?: 0) +
                        (unknown.asKnown().getOrNull()?.validity() ?: 0) +
                        (vision.asKnown().getOrNull()?.validity() ?: 0)

                /** The part of this transaction amount that was for clinic-related services. */
                class Clinic
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Clinic].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Clinic]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(clinic: Clinic) = apply {
                            amount = clinic.amount
                            currency = clinic.currency
                            additionalProperties = clinic.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Clinic].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Clinic =
                            Clinic(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Clinic = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Clinic &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Clinic{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for dental-related services. */
                class Dental
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Dental].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Dental]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(dental: Dental) = apply {
                            amount = dental.amount
                            currency = dental.currency
                            additionalProperties = dental.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Dental].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Dental =
                            Dental(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Dental = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Dental &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Dental{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The original pre-authorized amount. */
                class Original
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Original].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Original]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(original: Original) = apply {
                            amount = original.amount
                            currency = original.currency
                            additionalProperties = original.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Original].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Original =
                            Original(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Original = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Original &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Original{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for healthcare prescriptions. */
                class Prescription
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Prescription].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Prescription]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(prescription: Prescription) = apply {
                            amount = prescription.amount
                            currency = prescription.currency
                            additionalProperties = prescription.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Prescription].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Prescription =
                            Prescription(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Prescription = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Prescription &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Prescription{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The surcharge amount charged for this transaction by the merchant. */
                class Surcharge
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Surcharge].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Surcharge]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(surcharge: Surcharge) = apply {
                            amount = surcharge.amount
                            currency = surcharge.currency
                            additionalProperties = surcharge.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Surcharge].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Surcharge =
                            Surcharge(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Surcharge = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Surcharge &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Surcharge{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /**
                 * The total amount of a series of incremental authorizations, optionally provided.
                 */
                class TotalCumulative
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [TotalCumulative].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [TotalCumulative]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(totalCumulative: TotalCumulative) = apply {
                            amount = totalCumulative.amount
                            currency = totalCumulative.currency
                            additionalProperties =
                                totalCumulative.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [TotalCumulative].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): TotalCumulative =
                            TotalCumulative(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): TotalCumulative = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is TotalCumulative &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "TotalCumulative{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The total amount of healthcare-related additional amounts. */
                class TotalHealthcare
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [TotalHealthcare].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [TotalHealthcare]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(totalHealthcare: TotalHealthcare) = apply {
                            amount = totalHealthcare.amount
                            currency = totalHealthcare.currency
                            additionalProperties =
                                totalHealthcare.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [TotalHealthcare].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): TotalHealthcare =
                            TotalHealthcare(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): TotalHealthcare = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is TotalHealthcare &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "TotalHealthcare{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for transit-related services. */
                class Transit
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Transit].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Transit]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(transit: Transit) = apply {
                            amount = transit.amount
                            currency = transit.currency
                            additionalProperties = transit.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Transit].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Transit =
                            Transit(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Transit = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Transit &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Transit{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** An unknown additional amount. */
                class Unknown
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Unknown].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Unknown]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(unknown: Unknown) = apply {
                            amount = unknown.amount
                            currency = unknown.currency
                            additionalProperties = unknown.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Unknown].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Unknown =
                            Unknown(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Unknown = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Unknown &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Unknown{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for vision-related services. */
                class Vision
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Vision].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Vision]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(vision: Vision) = apply {
                            amount = vision.amount
                            currency = vision.currency
                            additionalProperties = vision.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Vision].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Vision =
                            Vision(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Vision = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Vision &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Vision{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is AdditionalAmounts &&
                        clinic == other.clinic &&
                        dental == other.dental &&
                        original == other.original &&
                        prescription == other.prescription &&
                        surcharge == other.surcharge &&
                        totalCumulative == other.totalCumulative &&
                        totalHealthcare == other.totalHealthcare &&
                        transit == other.transit &&
                        unknown == other.unknown &&
                        vision == other.vision &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        clinic,
                        dental,
                        original,
                        prescription,
                        surcharge,
                        totalCumulative,
                        totalHealthcare,
                        transit,
                        unknown,
                        vision,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "AdditionalAmounts{clinic=$clinic, dental=$dental, original=$original, prescription=$prescription, surcharge=$surcharge, totalCumulative=$totalCumulative, totalHealthcare=$totalHealthcare, transit=$transit, unknown=$unknown, vision=$vision, additionalProperties=$additionalProperties}"
            }

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's
             * currency.
             */
            class Currency @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** US Dollar (USD) */
                    @JvmField val USD = of("USD")

                    @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                }

                /** An enum containing [Currency]'s known values. */
                enum class Known {
                    /** US Dollar (USD) */
                    USD
                }

                /**
                 * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Currency] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** US Dollar (USD) */
                    USD,
                    /**
                     * An enum member indicating that [Currency] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        USD -> Value.USD
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        USD -> Known.USD
                        else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Currency = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Currency && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** The card network used to process this card authorization. */
            class Network @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** Visa */
                    @JvmField val VISA = of("visa")

                    /** Pulse */
                    @JvmField val PULSE = of("pulse")

                    @JvmStatic fun of(value: String) = Network(JsonField.of(value))
                }

                /** An enum containing [Network]'s known values. */
                enum class Known {
                    /** Visa */
                    VISA,
                    /** Pulse */
                    PULSE,
                }

                /**
                 * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Network] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** Visa */
                    VISA,
                    /** Pulse */
                    PULSE,
                    /**
                     * An enum member indicating that [Network] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        VISA -> Value.VISA
                        PULSE -> Value.PULSE
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        VISA -> Known.VISA
                        PULSE -> Known.PULSE
                        else -> throw IncreaseInvalidDataException("Unknown Network: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Network = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Network && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** Network-specific identifiers for a specific request or transaction. */
            class NetworkIdentifiers
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val authorizationIdentificationResponse: JsonField<String>,
                private val retrievalReferenceNumber: JsonField<String>,
                private val traceNumber: JsonField<String>,
                private val transactionId: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("authorization_identification_response")
                    @ExcludeMissing
                    authorizationIdentificationResponse: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("retrieval_reference_number")
                    @ExcludeMissing
                    retrievalReferenceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("trace_number")
                    @ExcludeMissing
                    traceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("transaction_id")
                    @ExcludeMissing
                    transactionId: JsonField<String> = JsonMissing.of(),
                ) : this(
                    authorizationIdentificationResponse,
                    retrievalReferenceNumber,
                    traceNumber,
                    transactionId,
                    mutableMapOf(),
                )

                /**
                 * The randomly generated 6-character Authorization Identification Response code
                 * sent back to the acquirer in an approved response.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun authorizationIdentificationResponse(): Optional<String> =
                    authorizationIdentificationResponse.getOptional(
                        "authorization_identification_response"
                    )

                /**
                 * A life-cycle identifier used across e.g., an authorization and a reversal.
                 * Expected to be unique per acquirer within a window of time. For some card
                 * networks the retrieval reference number includes the trace counter.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun retrievalReferenceNumber(): Optional<String> =
                    retrievalReferenceNumber.getOptional("retrieval_reference_number")

                /**
                 * A counter used to verify an individual authorization. Expected to be unique per
                 * acquirer within a window of time.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun traceNumber(): Optional<String> = traceNumber.getOptional("trace_number")

                /**
                 * A globally unique transaction identifier provided by the card network, used
                 * across multiple life-cycle requests.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun transactionId(): Optional<String> = transactionId.getOptional("transaction_id")

                /**
                 * Returns the raw JSON value of [authorizationIdentificationResponse].
                 *
                 * Unlike [authorizationIdentificationResponse], this method doesn't throw if the
                 * JSON field has an unexpected type.
                 */
                @JsonProperty("authorization_identification_response")
                @ExcludeMissing
                fun _authorizationIdentificationResponse(): JsonField<String> =
                    authorizationIdentificationResponse

                /**
                 * Returns the raw JSON value of [retrievalReferenceNumber].
                 *
                 * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field
                 * has an unexpected type.
                 */
                @JsonProperty("retrieval_reference_number")
                @ExcludeMissing
                fun _retrievalReferenceNumber(): JsonField<String> = retrievalReferenceNumber

                /**
                 * Returns the raw JSON value of [traceNumber].
                 *
                 * Unlike [traceNumber], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("trace_number")
                @ExcludeMissing
                fun _traceNumber(): JsonField<String> = traceNumber

                /**
                 * Returns the raw JSON value of [transactionId].
                 *
                 * Unlike [transactionId], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("transaction_id")
                @ExcludeMissing
                fun _transactionId(): JsonField<String> = transactionId

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of
                     * [NetworkIdentifiers].
                     *
                     * The following fields are required:
                     * ```java
                     * .authorizationIdentificationResponse()
                     * .retrievalReferenceNumber()
                     * .traceNumber()
                     * .transactionId()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [NetworkIdentifiers]. */
                class Builder internal constructor() {

                    private var authorizationIdentificationResponse: JsonField<String>? = null
                    private var retrievalReferenceNumber: JsonField<String>? = null
                    private var traceNumber: JsonField<String>? = null
                    private var transactionId: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(networkIdentifiers: NetworkIdentifiers) = apply {
                        authorizationIdentificationResponse =
                            networkIdentifiers.authorizationIdentificationResponse
                        retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber
                        traceNumber = networkIdentifiers.traceNumber
                        transactionId = networkIdentifiers.transactionId
                        additionalProperties =
                            networkIdentifiers.additionalProperties.toMutableMap()
                    }

                    /**
                     * The randomly generated 6-character Authorization Identification Response code
                     * sent back to the acquirer in an approved response.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: String?
                    ) =
                        authorizationIdentificationResponse(
                            JsonField.ofNullable(authorizationIdentificationResponse)
                        )

                    /**
                     * Alias for calling [Builder.authorizationIdentificationResponse] with
                     * `authorizationIdentificationResponse.orElse(null)`.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: Optional<String>
                    ) =
                        authorizationIdentificationResponse(
                            authorizationIdentificationResponse.getOrNull()
                        )

                    /**
                     * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON
                     * value.
                     *
                     * You should usually call [Builder.authorizationIdentificationResponse] with a
                     * well-typed [String] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: JsonField<String>
                    ) = apply {
                        this.authorizationIdentificationResponse =
                            authorizationIdentificationResponse
                    }

                    /**
                     * A life-cycle identifier used across e.g., an authorization and a reversal.
                     * Expected to be unique per acquirer within a window of time. For some card
                     * networks the retrieval reference number includes the trace counter.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: String?) =
                        retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber))

                    /**
                     * Alias for calling [Builder.retrievalReferenceNumber] with
                     * `retrievalReferenceNumber.orElse(null)`.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: Optional<String>) =
                        retrievalReferenceNumber(retrievalReferenceNumber.getOrNull())

                    /**
                     * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.retrievalReferenceNumber] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField<String>) =
                        apply {
                            this.retrievalReferenceNumber = retrievalReferenceNumber
                        }

                    /**
                     * A counter used to verify an individual authorization. Expected to be unique
                     * per acquirer within a window of time.
                     */
                    fun traceNumber(traceNumber: String?) =
                        traceNumber(JsonField.ofNullable(traceNumber))

                    /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */
                    fun traceNumber(traceNumber: Optional<String>) =
                        traceNumber(traceNumber.getOrNull())

                    /**
                     * Sets [Builder.traceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.traceNumber] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun traceNumber(traceNumber: JsonField<String>) = apply {
                        this.traceNumber = traceNumber
                    }

                    /**
                     * A globally unique transaction identifier provided by the card network, used
                     * across multiple life-cycle requests.
                     */
                    fun transactionId(transactionId: String?) =
                        transactionId(JsonField.ofNullable(transactionId))

                    /**
                     * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`.
                     */
                    fun transactionId(transactionId: Optional<String>) =
                        transactionId(transactionId.getOrNull())

                    /**
                     * Sets [Builder.transactionId] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.transactionId] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun transactionId(transactionId: JsonField<String>) = apply {
                        this.transactionId = transactionId
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [NetworkIdentifiers].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .authorizationIdentificationResponse()
                     * .retrievalReferenceNumber()
                     * .traceNumber()
                     * .transactionId()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): NetworkIdentifiers =
                        NetworkIdentifiers(
                            checkRequired(
                                "authorizationIdentificationResponse",
                                authorizationIdentificationResponse,
                            ),
                            checkRequired("retrievalReferenceNumber", retrievalReferenceNumber),
                            checkRequired("traceNumber", traceNumber),
                            checkRequired("transactionId", transactionId),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): NetworkIdentifiers = apply {
                    if (validated) {
                        return@apply
                    }

                    authorizationIdentificationResponse()
                    retrievalReferenceNumber()
                    traceNumber()
                    transactionId()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) +
                        (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) +
                        (if (traceNumber.asKnown().isPresent) 1 else 0) +
                        (if (transactionId.asKnown().isPresent) 1 else 0)

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is NetworkIdentifiers &&
                        authorizationIdentificationResponse ==
                            other.authorizationIdentificationResponse &&
                        retrievalReferenceNumber == other.retrievalReferenceNumber &&
                        traceNumber == other.traceNumber &&
                        transactionId == other.transactionId &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        authorizationIdentificationResponse,
                        retrievalReferenceNumber,
                        traceNumber,
                        transactionId,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}"
            }

            class SchemeFee
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val amount: JsonField<String>,
                private val createdAt: JsonField<OffsetDateTime>,
                private val currency: JsonField<Currency>,
                private val feeType: JsonField<FeeType>,
                private val fixedComponent: JsonField<String>,
                private val variableRate: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("amount")
                    @ExcludeMissing
                    amount: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("created_at")
                    @ExcludeMissing
                    createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                    @JsonProperty("currency")
                    @ExcludeMissing
                    currency: JsonField<Currency> = JsonMissing.of(),
                    @JsonProperty("fee_type")
                    @ExcludeMissing
                    feeType: JsonField<FeeType> = JsonMissing.of(),
                    @JsonProperty("fixed_component")
                    @ExcludeMissing
                    fixedComponent: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("variable_rate")
                    @ExcludeMissing
                    variableRate: JsonField<String> = JsonMissing.of(),
                ) : this(
                    amount,
                    createdAt,
                    currency,
                    feeType,
                    fixedComponent,
                    variableRate,
                    mutableMapOf(),
                )

                /**
                 * The fee amount given as a string containing a decimal number.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun amount(): String = amount.getRequired("amount")

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was
                 * created.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /**
                 * The type of fee being assessed.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun feeType(): FeeType = feeType.getRequired("fee_type")

                /**
                 * The fixed component of the fee, if applicable, given in major units of the fee
                 * amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun fixedComponent(): Optional<String> =
                    fixedComponent.getOptional("fixed_component")

                /**
                 * The variable rate component of the fee, if applicable, given as a decimal (e.g.,
                 * 0.015 for 1.5%).
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun variableRate(): Optional<String> = variableRate.getOptional("variable_rate")

                /**
                 * Returns the raw JSON value of [amount].
                 *
                 * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<String> = amount

                /**
                 * Returns the raw JSON value of [createdAt].
                 *
                 * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("created_at")
                @ExcludeMissing
                fun _createdAt(): JsonField<OffsetDateTime> = createdAt

                /**
                 * Returns the raw JSON value of [currency].
                 *
                 * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun _currency(): JsonField<Currency> = currency

                /**
                 * Returns the raw JSON value of [feeType].
                 *
                 * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("fee_type")
                @ExcludeMissing
                fun _feeType(): JsonField<FeeType> = feeType

                /**
                 * Returns the raw JSON value of [fixedComponent].
                 *
                 * Unlike [fixedComponent], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("fixed_component")
                @ExcludeMissing
                fun _fixedComponent(): JsonField<String> = fixedComponent

                /**
                 * Returns the raw JSON value of [variableRate].
                 *
                 * Unlike [variableRate], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("variable_rate")
                @ExcludeMissing
                fun _variableRate(): JsonField<String> = variableRate

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [SchemeFee].
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [SchemeFee]. */
                class Builder internal constructor() {

                    private var amount: JsonField<String>? = null
                    private var createdAt: JsonField<OffsetDateTime>? = null
                    private var currency: JsonField<Currency>? = null
                    private var feeType: JsonField<FeeType>? = null
                    private var fixedComponent: JsonField<String>? = null
                    private var variableRate: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(schemeFee: SchemeFee) = apply {
                        amount = schemeFee.amount
                        createdAt = schemeFee.createdAt
                        currency = schemeFee.currency
                        feeType = schemeFee.feeType
                        fixedComponent = schemeFee.fixedComponent
                        variableRate = schemeFee.variableRate
                        additionalProperties = schemeFee.additionalProperties.toMutableMap()
                    }

                    /** The fee amount given as a string containing a decimal number. */
                    fun amount(amount: String) = amount(JsonField.of(amount))

                    /**
                     * Sets [Builder.amount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.amount] with a well-typed [String] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun amount(amount: JsonField<String>) = apply { this.amount = amount }

                    /**
                     * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee
                     * was created.
                     */
                    fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt))

                    /**
                     * Sets [Builder.createdAt] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.createdAt] with a well-typed
                     * [OffsetDateTime] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply {
                        this.createdAt = createdAt
                    }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                     * reimbursement.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * Sets [Builder.currency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.currency] with a well-typed [Currency] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                    /** The type of fee being assessed. */
                    fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType))

                    /**
                     * Sets [Builder.feeType] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.feeType] with a well-typed [FeeType] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun feeType(feeType: JsonField<FeeType>) = apply { this.feeType = feeType }

                    /**
                     * The fixed component of the fee, if applicable, given in major units of the
                     * fee amount.
                     */
                    fun fixedComponent(fixedComponent: String?) =
                        fixedComponent(JsonField.ofNullable(fixedComponent))

                    /**
                     * Alias for calling [Builder.fixedComponent] with
                     * `fixedComponent.orElse(null)`.
                     */
                    fun fixedComponent(fixedComponent: Optional<String>) =
                        fixedComponent(fixedComponent.getOrNull())

                    /**
                     * Sets [Builder.fixedComponent] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.fixedComponent] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun fixedComponent(fixedComponent: JsonField<String>) = apply {
                        this.fixedComponent = fixedComponent
                    }

                    /**
                     * The variable rate component of the fee, if applicable, given as a decimal
                     * (e.g., 0.015 for 1.5%).
                     */
                    fun variableRate(variableRate: String?) =
                        variableRate(JsonField.ofNullable(variableRate))

                    /**
                     * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`.
                     */
                    fun variableRate(variableRate: Optional<String>) =
                        variableRate(variableRate.getOrNull())

                    /**
                     * Sets [Builder.variableRate] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.variableRate] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun variableRate(variableRate: JsonField<String>) = apply {
                        this.variableRate = variableRate
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [SchemeFee].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): SchemeFee =
                        SchemeFee(
                            checkRequired("amount", amount),
                            checkRequired("createdAt", createdAt),
                            checkRequired("currency", currency),
                            checkRequired("feeType", feeType),
                            checkRequired("fixedComponent", fixedComponent),
                            checkRequired("variableRate", variableRate),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): SchemeFee = apply {
                    if (validated) {
                        return@apply
                    }

                    amount()
                    createdAt()
                    currency().validate()
                    feeType().validate()
                    fixedComponent()
                    variableRate()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (amount.asKnown().isPresent) 1 else 0) +
                        (if (createdAt.asKnown().isPresent) 1 else 0) +
                        (currency.asKnown().getOrNull()?.validity() ?: 0) +
                        (feeType.asKnown().getOrNull()?.validity() ?: 0) +
                        (if (fixedComponent.asKnown().isPresent) 1 else 0) +
                        (if (variableRate.asKnown().isPresent) 1 else 0)

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 */
                class Currency
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** US Dollar (USD) */
                        @JvmField val USD = of("USD")

                        @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                    }

                    /** An enum containing [Currency]'s known values. */
                    enum class Known {
                        /** US Dollar (USD) */
                        USD
                    }

                    /**
                     * An enum containing [Currency]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Currency] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** US Dollar (USD) */
                        USD,
                        /**
                         * An enum member indicating that [Currency] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            USD -> Value.USD
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            USD -> Known.USD
                            else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Currency = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Currency && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** The type of fee being assessed. */
                class FeeType
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY =
                            of("visa_international_service_assessment_single_currency")

                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY =
                            of("visa_international_service_assessment_cross_currency")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE =
                            of("visa_authorization_domestic_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_international_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE =
                            of("visa_authorization_canada_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_international_point_of_sale")

                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE =
                            of("visa_authorization_address_verification_service")

                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        @JvmField
                        val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization")

                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission")

                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_DOMESTIC =
                            of("visa_account_verification_domestic")

                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL =
                            of("visa_account_verification_international")

                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_CANADA =
                            of("visa_account_verification_canada")

                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee")

                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        @JvmField
                        val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE =
                            of("visa_consumer_debit_acceptance_fee")

                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        @JvmField
                        val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE =
                            of("visa_business_debit_acceptance_fee")

                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee")

                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic")

                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        @JvmField
                        val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international")

                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token")

                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token")

                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission")

                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization")

                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        @JvmField
                        val VISA_DIRECT_TRANSACTION_DOMESTIC =
                            of("visa_direct_transaction_domestic")

                        /** Issuer card service fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit")

                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT =
                            of("visa_advertising_service_commercial_credit")

                        /** Issuer Community Growth Acceleration Program Fee. */
                        @JvmField
                        val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM =
                            of("visa_community_growth_acceleration_program")

                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        @JvmField
                        val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT =
                            of("visa_processing_guarantee_commercial_credit")

                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee")

                        @JvmStatic fun of(value: String) = FeeType(JsonField.of(value))
                    }

                    /** An enum containing [FeeType]'s known values. */
                    enum class Known {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                    }

                    /**
                     * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member.
                     *
                     * An instance of [FeeType] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                        /**
                         * An enum member indicating that [FeeType] was instantiated with an unknown
                         * value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Value.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Value.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Known.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Known.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE
                            else -> throw IncreaseInvalidDataException("Unknown FeeType: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): FeeType = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is FeeType && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is SchemeFee &&
                        amount == other.amount &&
                        createdAt == other.createdAt &&
                        currency == other.currency &&
                        feeType == other.feeType &&
                        fixedComponent == other.fixedComponent &&
                        variableRate == other.variableRate &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        amount,
                        createdAt,
                        currency,
                        feeType,
                        fixedComponent,
                        variableRate,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}"
            }

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_increment`.
             */
            class Type @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    @JvmField val CARD_INCREMENT = of("card_increment")

                    @JvmStatic fun of(value: String) = Type(JsonField.of(value))
                }

                /** An enum containing [Type]'s known values. */
                enum class Known {
                    CARD_INCREMENT
                }

                /**
                 * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Type] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    CARD_INCREMENT,
                    /**
                     * An enum member indicating that [Type] was instantiated with an unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        CARD_INCREMENT -> Value.CARD_INCREMENT
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        CARD_INCREMENT -> Known.CARD_INCREMENT
                        else -> throw IncreaseInvalidDataException("Unknown Type: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Type = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Type && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            override fun equals(other: Any?): Boolean {
                if (this === other) {
                    return true
                }

                return other is CardIncrement &&
                    id == other.id &&
                    actioner == other.actioner &&
                    additionalAmounts == other.additionalAmounts &&
                    amount == other.amount &&
                    cardAuthorizationId == other.cardAuthorizationId &&
                    currency == other.currency &&
                    network == other.network &&
                    networkIdentifiers == other.networkIdentifiers &&
                    networkRiskScore == other.networkRiskScore &&
                    pendingTransactionId == other.pendingTransactionId &&
                    presentmentAmount == other.presentmentAmount &&
                    presentmentCurrency == other.presentmentCurrency &&
                    realTimeDecisionId == other.realTimeDecisionId &&
                    schemeFees == other.schemeFees &&
                    type == other.type &&
                    updatedAuthorizationAmount == other.updatedAuthorizationAmount &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    id,
                    actioner,
                    additionalAmounts,
                    amount,
                    cardAuthorizationId,
                    currency,
                    network,
                    networkIdentifiers,
                    networkRiskScore,
                    pendingTransactionId,
                    presentmentAmount,
                    presentmentCurrency,
                    realTimeDecisionId,
                    schemeFees,
                    type,
                    updatedAuthorizationAmount,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardIncrement{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardAuthorizationId=$cardAuthorizationId, currency=$currency, network=$network, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, pendingTransactionId=$pendingTransactionId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, realTimeDecisionId=$realTimeDecisionId, schemeFees=$schemeFees, type=$type, updatedAuthorizationAmount=$updatedAuthorizationAmount, additionalProperties=$additionalProperties}"
        }

        /**
         * A Card Refund object. This field will be present in the JSON response if and only if
         * `category` is equal to `card_refund`. Card Refunds move money back to the cardholder.
         * While they are usually connected to a Card Settlement, an acquirer can also refund money
         * directly to a card without relation to a transaction.
         */
        class CardRefund
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val id: JsonField<String>,
            private val amount: JsonField<Long>,
            private val cardPaymentId: JsonField<String>,
            private val cashback: JsonField<Cashback>,
            private val currency: JsonField<Currency>,
            private val interchange: JsonField<Interchange>,
            private val merchantAcceptorId: JsonField<String>,
            private val merchantCategoryCode: JsonField<String>,
            private val merchantCity: JsonField<String>,
            private val merchantCountry: JsonField<String>,
            private val merchantName: JsonField<String>,
            private val merchantPostalCode: JsonField<String>,
            private val merchantState: JsonField<String>,
            private val networkIdentifiers: JsonField<NetworkIdentifiers>,
            private val presentmentAmount: JsonField<Long>,
            private val presentmentCurrency: JsonField<String>,
            private val purchaseDetails: JsonField<PurchaseDetails>,
            private val schemeFees: JsonField<List<SchemeFee>>,
            private val transactionId: JsonField<String>,
            private val type: JsonField<Type>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("card_payment_id")
                @ExcludeMissing
                cardPaymentId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("cashback")
                @ExcludeMissing
                cashback: JsonField<Cashback> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("interchange")
                @ExcludeMissing
                interchange: JsonField<Interchange> = JsonMissing.of(),
                @JsonProperty("merchant_acceptor_id")
                @ExcludeMissing
                merchantAcceptorId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_category_code")
                @ExcludeMissing
                merchantCategoryCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_city")
                @ExcludeMissing
                merchantCity: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_country")
                @ExcludeMissing
                merchantCountry: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_name")
                @ExcludeMissing
                merchantName: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_postal_code")
                @ExcludeMissing
                merchantPostalCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_state")
                @ExcludeMissing
                merchantState: JsonField<String> = JsonMissing.of(),
                @JsonProperty("network_identifiers")
                @ExcludeMissing
                networkIdentifiers: JsonField<NetworkIdentifiers> = JsonMissing.of(),
                @JsonProperty("presentment_amount")
                @ExcludeMissing
                presentmentAmount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("presentment_currency")
                @ExcludeMissing
                presentmentCurrency: JsonField<String> = JsonMissing.of(),
                @JsonProperty("purchase_details")
                @ExcludeMissing
                purchaseDetails: JsonField<PurchaseDetails> = JsonMissing.of(),
                @JsonProperty("scheme_fees")
                @ExcludeMissing
                schemeFees: JsonField<List<SchemeFee>> = JsonMissing.of(),
                @JsonProperty("transaction_id")
                @ExcludeMissing
                transactionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
            ) : this(
                id,
                amount,
                cardPaymentId,
                cashback,
                currency,
                interchange,
                merchantAcceptorId,
                merchantCategoryCode,
                merchantCity,
                merchantCountry,
                merchantName,
                merchantPostalCode,
                merchantState,
                networkIdentifiers,
                presentmentAmount,
                presentmentCurrency,
                purchaseDetails,
                schemeFees,
                transactionId,
                type,
                mutableMapOf(),
            )

            /**
             * The Card Refund identifier.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun id(): String = id.getRequired("id")

            /**
             * The amount in the minor unit of the transaction's settlement currency. For dollars,
             * for example, this is cents.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun amount(): Long = amount.getRequired("amount")

            /**
             * The ID of the Card Payment this transaction belongs to.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun cardPaymentId(): String = cardPaymentId.getRequired("card_payment_id")

            /**
             * Cashback debited for this transaction, if eligible. Cashback is paid out in
             * aggregate, monthly.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun cashback(): Optional<Cashback> = cashback.getOptional("cashback")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
             * settlement currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun currency(): Currency = currency.getRequired("currency")

            /**
             * Interchange assessed as a part of this transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun interchange(): Optional<Interchange> = interchange.getOptional("interchange")

            /**
             * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantAcceptorId(): String =
                merchantAcceptorId.getRequired("merchant_acceptor_id")

            /**
             * The 4-digit MCC describing the merchant's business.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCategoryCode(): String =
                merchantCategoryCode.getRequired("merchant_category_code")

            /**
             * The city the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCity(): String = merchantCity.getRequired("merchant_city")

            /**
             * The country the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCountry(): String = merchantCountry.getRequired("merchant_country")

            /**
             * The name of the merchant.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantName(): String = merchantName.getRequired("merchant_name")

            /**
             * The merchant's postal code. For US merchants this is always a 5-digit ZIP code.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantPostalCode(): Optional<String> =
                merchantPostalCode.getOptional("merchant_postal_code")

            /**
             * The state the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantState(): Optional<String> = merchantState.getOptional("merchant_state")

            /**
             * Network-specific identifiers for this refund.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun networkIdentifiers(): NetworkIdentifiers =
                networkIdentifiers.getRequired("network_identifiers")

            /**
             * The amount in the minor unit of the transaction's presentment currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun presentmentAmount(): Long = presentmentAmount.getRequired("presentment_amount")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
             * presentment currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun presentmentCurrency(): String =
                presentmentCurrency.getRequired("presentment_currency")

            /**
             * Additional details about the card purchase, such as tax and industry-specific fields.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun purchaseDetails(): Optional<PurchaseDetails> =
                purchaseDetails.getOptional("purchase_details")

            /**
             * The scheme fees associated with this card refund.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun schemeFees(): List<SchemeFee> = schemeFees.getRequired("scheme_fees")

            /**
             * The identifier of the Transaction associated with this Transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun transactionId(): String = transactionId.getRequired("transaction_id")

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_refund`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun type(): Type = type.getRequired("type")

            /**
             * Returns the raw JSON value of [id].
             *
             * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id

            /**
             * Returns the raw JSON value of [amount].
             *
             * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

            /**
             * Returns the raw JSON value of [cardPaymentId].
             *
             * Unlike [cardPaymentId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("card_payment_id")
            @ExcludeMissing
            fun _cardPaymentId(): JsonField<String> = cardPaymentId

            /**
             * Returns the raw JSON value of [cashback].
             *
             * Unlike [cashback], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("cashback")
            @ExcludeMissing
            fun _cashback(): JsonField<Cashback> = cashback

            /**
             * Returns the raw JSON value of [currency].
             *
             * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("currency")
            @ExcludeMissing
            fun _currency(): JsonField<Currency> = currency

            /**
             * Returns the raw JSON value of [interchange].
             *
             * Unlike [interchange], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("interchange")
            @ExcludeMissing
            fun _interchange(): JsonField<Interchange> = interchange

            /**
             * Returns the raw JSON value of [merchantAcceptorId].
             *
             * Unlike [merchantAcceptorId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_acceptor_id")
            @ExcludeMissing
            fun _merchantAcceptorId(): JsonField<String> = merchantAcceptorId

            /**
             * Returns the raw JSON value of [merchantCategoryCode].
             *
             * Unlike [merchantCategoryCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_category_code")
            @ExcludeMissing
            fun _merchantCategoryCode(): JsonField<String> = merchantCategoryCode

            /**
             * Returns the raw JSON value of [merchantCity].
             *
             * Unlike [merchantCity], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_city")
            @ExcludeMissing
            fun _merchantCity(): JsonField<String> = merchantCity

            /**
             * Returns the raw JSON value of [merchantCountry].
             *
             * Unlike [merchantCountry], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_country")
            @ExcludeMissing
            fun _merchantCountry(): JsonField<String> = merchantCountry

            /**
             * Returns the raw JSON value of [merchantName].
             *
             * Unlike [merchantName], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_name")
            @ExcludeMissing
            fun _merchantName(): JsonField<String> = merchantName

            /**
             * Returns the raw JSON value of [merchantPostalCode].
             *
             * Unlike [merchantPostalCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_postal_code")
            @ExcludeMissing
            fun _merchantPostalCode(): JsonField<String> = merchantPostalCode

            /**
             * Returns the raw JSON value of [merchantState].
             *
             * Unlike [merchantState], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_state")
            @ExcludeMissing
            fun _merchantState(): JsonField<String> = merchantState

            /**
             * Returns the raw JSON value of [networkIdentifiers].
             *
             * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_identifiers")
            @ExcludeMissing
            fun _networkIdentifiers(): JsonField<NetworkIdentifiers> = networkIdentifiers

            /**
             * Returns the raw JSON value of [presentmentAmount].
             *
             * Unlike [presentmentAmount], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("presentment_amount")
            @ExcludeMissing
            fun _presentmentAmount(): JsonField<Long> = presentmentAmount

            /**
             * Returns the raw JSON value of [presentmentCurrency].
             *
             * Unlike [presentmentCurrency], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("presentment_currency")
            @ExcludeMissing
            fun _presentmentCurrency(): JsonField<String> = presentmentCurrency

            /**
             * Returns the raw JSON value of [purchaseDetails].
             *
             * Unlike [purchaseDetails], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("purchase_details")
            @ExcludeMissing
            fun _purchaseDetails(): JsonField<PurchaseDetails> = purchaseDetails

            /**
             * Returns the raw JSON value of [schemeFees].
             *
             * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("scheme_fees")
            @ExcludeMissing
            fun _schemeFees(): JsonField<List<SchemeFee>> = schemeFees

            /**
             * Returns the raw JSON value of [transactionId].
             *
             * Unlike [transactionId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("transaction_id")
            @ExcludeMissing
            fun _transactionId(): JsonField<String> = transactionId

            /**
             * Returns the raw JSON value of [type].
             *
             * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("type") @ExcludeMissing fun _type(): JsonField<Type> = type

            @JsonAnySetter
            private fun putAdditionalProperty(key: String, value: JsonValue) {
                additionalProperties.put(key, value)
            }

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map<String, JsonValue> =
                Collections.unmodifiableMap(additionalProperties)

            fun toBuilder() = Builder().from(this)

            companion object {

                /**
                 * Returns a mutable builder for constructing an instance of [CardRefund].
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .amount()
                 * .cardPaymentId()
                 * .cashback()
                 * .currency()
                 * .interchange()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCity()
                 * .merchantCountry()
                 * .merchantName()
                 * .merchantPostalCode()
                 * .merchantState()
                 * .networkIdentifiers()
                 * .presentmentAmount()
                 * .presentmentCurrency()
                 * .purchaseDetails()
                 * .schemeFees()
                 * .transactionId()
                 * .type()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

            /** A builder for [CardRefund]. */
            class Builder internal constructor() {

                private var id: JsonField<String>? = null
                private var amount: JsonField<Long>? = null
                private var cardPaymentId: JsonField<String>? = null
                private var cashback: JsonField<Cashback>? = null
                private var currency: JsonField<Currency>? = null
                private var interchange: JsonField<Interchange>? = null
                private var merchantAcceptorId: JsonField<String>? = null
                private var merchantCategoryCode: JsonField<String>? = null
                private var merchantCity: JsonField<String>? = null
                private var merchantCountry: JsonField<String>? = null
                private var merchantName: JsonField<String>? = null
                private var merchantPostalCode: JsonField<String>? = null
                private var merchantState: JsonField<String>? = null
                private var networkIdentifiers: JsonField<NetworkIdentifiers>? = null
                private var presentmentAmount: JsonField<Long>? = null
                private var presentmentCurrency: JsonField<String>? = null
                private var purchaseDetails: JsonField<PurchaseDetails>? = null
                private var schemeFees: JsonField<MutableList<SchemeFee>>? = null
                private var transactionId: JsonField<String>? = null
                private var type: JsonField<Type>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardRefund: CardRefund) = apply {
                    id = cardRefund.id
                    amount = cardRefund.amount
                    cardPaymentId = cardRefund.cardPaymentId
                    cashback = cardRefund.cashback
                    currency = cardRefund.currency
                    interchange = cardRefund.interchange
                    merchantAcceptorId = cardRefund.merchantAcceptorId
                    merchantCategoryCode = cardRefund.merchantCategoryCode
                    merchantCity = cardRefund.merchantCity
                    merchantCountry = cardRefund.merchantCountry
                    merchantName = cardRefund.merchantName
                    merchantPostalCode = cardRefund.merchantPostalCode
                    merchantState = cardRefund.merchantState
                    networkIdentifiers = cardRefund.networkIdentifiers
                    presentmentAmount = cardRefund.presentmentAmount
                    presentmentCurrency = cardRefund.presentmentCurrency
                    purchaseDetails = cardRefund.purchaseDetails
                    schemeFees = cardRefund.schemeFees.map { it.toMutableList() }
                    transactionId = cardRefund.transactionId
                    type = cardRefund.type
                    additionalProperties = cardRefund.additionalProperties.toMutableMap()
                }

                /** The Card Refund identifier. */
                fun id(id: String) = id(JsonField.of(id))

                /**
                 * Sets [Builder.id] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.id] with a well-typed [String] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun id(id: JsonField<String>) = apply { this.id = id }

                /**
                 * The amount in the minor unit of the transaction's settlement currency. For
                 * dollars, for example, this is cents.
                 */
                fun amount(amount: Long) = amount(JsonField.of(amount))

                /**
                 * Sets [Builder.amount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.amount] with a well-typed [Long] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                /** The ID of the Card Payment this transaction belongs to. */
                fun cardPaymentId(cardPaymentId: String) =
                    cardPaymentId(JsonField.of(cardPaymentId))

                /**
                 * Sets [Builder.cardPaymentId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cardPaymentId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun cardPaymentId(cardPaymentId: JsonField<String>) = apply {
                    this.cardPaymentId = cardPaymentId
                }

                /**
                 * Cashback debited for this transaction, if eligible. Cashback is paid out in
                 * aggregate, monthly.
                 */
                fun cashback(cashback: Cashback?) = cashback(JsonField.ofNullable(cashback))

                /** Alias for calling [Builder.cashback] with `cashback.orElse(null)`. */
                fun cashback(cashback: Optional<Cashback>) = cashback(cashback.getOrNull())

                /**
                 * Sets [Builder.cashback] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cashback] with a well-typed [Cashback] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun cashback(cashback: JsonField<Cashback>) = apply { this.cashback = cashback }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
                 * settlement currency.
                 */
                fun currency(currency: Currency) = currency(JsonField.of(currency))

                /**
                 * Sets [Builder.currency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.currency] with a well-typed [Currency] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                /** Interchange assessed as a part of this transaction. */
                fun interchange(interchange: Interchange?) =
                    interchange(JsonField.ofNullable(interchange))

                /** Alias for calling [Builder.interchange] with `interchange.orElse(null)`. */
                fun interchange(interchange: Optional<Interchange>) =
                    interchange(interchange.getOrNull())

                /**
                 * Sets [Builder.interchange] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.interchange] with a well-typed [Interchange]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun interchange(interchange: JsonField<Interchange>) = apply {
                    this.interchange = interchange
                }

                /**
                 * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
                 * transacting with.
                 */
                fun merchantAcceptorId(merchantAcceptorId: String) =
                    merchantAcceptorId(JsonField.of(merchantAcceptorId))

                /**
                 * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantAcceptorId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantAcceptorId(merchantAcceptorId: JsonField<String>) = apply {
                    this.merchantAcceptorId = merchantAcceptorId
                }

                /** The 4-digit MCC describing the merchant's business. */
                fun merchantCategoryCode(merchantCategoryCode: String) =
                    merchantCategoryCode(JsonField.of(merchantCategoryCode))

                /**
                 * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCategoryCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCategoryCode(merchantCategoryCode: JsonField<String>) = apply {
                    this.merchantCategoryCode = merchantCategoryCode
                }

                /** The city the merchant resides in. */
                fun merchantCity(merchantCity: String) = merchantCity(JsonField.of(merchantCity))

                /**
                 * Sets [Builder.merchantCity] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCity] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantCity(merchantCity: JsonField<String>) = apply {
                    this.merchantCity = merchantCity
                }

                /** The country the merchant resides in. */
                fun merchantCountry(merchantCountry: String) =
                    merchantCountry(JsonField.of(merchantCountry))

                /**
                 * Sets [Builder.merchantCountry] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCountry] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCountry(merchantCountry: JsonField<String>) = apply {
                    this.merchantCountry = merchantCountry
                }

                /** The name of the merchant. */
                fun merchantName(merchantName: String) = merchantName(JsonField.of(merchantName))

                /**
                 * Sets [Builder.merchantName] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantName] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantName(merchantName: JsonField<String>) = apply {
                    this.merchantName = merchantName
                }

                /**
                 * The merchant's postal code. For US merchants this is always a 5-digit ZIP code.
                 */
                fun merchantPostalCode(merchantPostalCode: String?) =
                    merchantPostalCode(JsonField.ofNullable(merchantPostalCode))

                /**
                 * Alias for calling [Builder.merchantPostalCode] with
                 * `merchantPostalCode.orElse(null)`.
                 */
                fun merchantPostalCode(merchantPostalCode: Optional<String>) =
                    merchantPostalCode(merchantPostalCode.getOrNull())

                /**
                 * Sets [Builder.merchantPostalCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantPostalCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantPostalCode(merchantPostalCode: JsonField<String>) = apply {
                    this.merchantPostalCode = merchantPostalCode
                }

                /** The state the merchant resides in. */
                fun merchantState(merchantState: String?) =
                    merchantState(JsonField.ofNullable(merchantState))

                /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */
                fun merchantState(merchantState: Optional<String>) =
                    merchantState(merchantState.getOrNull())

                /**
                 * Sets [Builder.merchantState] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantState] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantState(merchantState: JsonField<String>) = apply {
                    this.merchantState = merchantState
                }

                /** Network-specific identifiers for this refund. */
                fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) =
                    networkIdentifiers(JsonField.of(networkIdentifiers))

                /**
                 * Sets [Builder.networkIdentifiers] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkIdentifiers] with a well-typed
                 * [NetworkIdentifiers] value instead. This method is primarily for setting the
                 * field to an undocumented or not yet supported value.
                 */
                fun networkIdentifiers(networkIdentifiers: JsonField<NetworkIdentifiers>) = apply {
                    this.networkIdentifiers = networkIdentifiers
                }

                /** The amount in the minor unit of the transaction's presentment currency. */
                fun presentmentAmount(presentmentAmount: Long) =
                    presentmentAmount(JsonField.of(presentmentAmount))

                /**
                 * Sets [Builder.presentmentAmount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.presentmentAmount] with a well-typed [Long]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun presentmentAmount(presentmentAmount: JsonField<Long>) = apply {
                    this.presentmentAmount = presentmentAmount
                }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
                 * presentment currency.
                 */
                fun presentmentCurrency(presentmentCurrency: String) =
                    presentmentCurrency(JsonField.of(presentmentCurrency))

                /**
                 * Sets [Builder.presentmentCurrency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.presentmentCurrency] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun presentmentCurrency(presentmentCurrency: JsonField<String>) = apply {
                    this.presentmentCurrency = presentmentCurrency
                }

                /**
                 * Additional details about the card purchase, such as tax and industry-specific
                 * fields.
                 */
                fun purchaseDetails(purchaseDetails: PurchaseDetails?) =
                    purchaseDetails(JsonField.ofNullable(purchaseDetails))

                /**
                 * Alias for calling [Builder.purchaseDetails] with `purchaseDetails.orElse(null)`.
                 */
                fun purchaseDetails(purchaseDetails: Optional<PurchaseDetails>) =
                    purchaseDetails(purchaseDetails.getOrNull())

                /**
                 * Sets [Builder.purchaseDetails] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.purchaseDetails] with a well-typed
                 * [PurchaseDetails] value instead. This method is primarily for setting the field
                 * to an undocumented or not yet supported value.
                 */
                fun purchaseDetails(purchaseDetails: JsonField<PurchaseDetails>) = apply {
                    this.purchaseDetails = purchaseDetails
                }

                /** The scheme fees associated with this card refund. */
                fun schemeFees(schemeFees: List<SchemeFee>) = schemeFees(JsonField.of(schemeFees))

                /**
                 * Sets [Builder.schemeFees] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.schemeFees] with a well-typed `List<SchemeFee>`
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun schemeFees(schemeFees: JsonField<List<SchemeFee>>) = apply {
                    this.schemeFees = schemeFees.map { it.toMutableList() }
                }

                /**
                 * Adds a single [SchemeFee] to [schemeFees].
                 *
                 * @throws IllegalStateException if the field was previously set to a non-list.
                 */
                fun addSchemeFee(schemeFee: SchemeFee) = apply {
                    schemeFees =
                        (schemeFees ?: JsonField.of(mutableListOf())).also {
                            checkKnown("schemeFees", it).add(schemeFee)
                        }
                }

                /** The identifier of the Transaction associated with this Transaction. */
                fun transactionId(transactionId: String) =
                    transactionId(JsonField.of(transactionId))

                /**
                 * Sets [Builder.transactionId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.transactionId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun transactionId(transactionId: JsonField<String>) = apply {
                    this.transactionId = transactionId
                }

                /**
                 * A constant representing the object's type. For this resource it will always be
                 * `card_refund`.
                 */
                fun type(type: Type) = type(JsonField.of(type))

                /**
                 * Sets [Builder.type] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.type] with a well-typed [Type] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun type(type: JsonField<Type>) = apply { this.type = type }

                fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                    this.additionalProperties.clear()
                    putAllAdditionalProperties(additionalProperties)
                }

                fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                    additionalProperties.put(key, value)
                }

                fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun removeAdditionalProperty(key: String) = apply {
                    additionalProperties.remove(key)
                }

                fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                    keys.forEach(::removeAdditionalProperty)
                }

                /**
                 * Returns an immutable instance of [CardRefund].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .amount()
                 * .cardPaymentId()
                 * .cashback()
                 * .currency()
                 * .interchange()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCity()
                 * .merchantCountry()
                 * .merchantName()
                 * .merchantPostalCode()
                 * .merchantState()
                 * .networkIdentifiers()
                 * .presentmentAmount()
                 * .presentmentCurrency()
                 * .purchaseDetails()
                 * .schemeFees()
                 * .transactionId()
                 * .type()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardRefund =
                    CardRefund(
                        checkRequired("id", id),
                        checkRequired("amount", amount),
                        checkRequired("cardPaymentId", cardPaymentId),
                        checkRequired("cashback", cashback),
                        checkRequired("currency", currency),
                        checkRequired("interchange", interchange),
                        checkRequired("merchantAcceptorId", merchantAcceptorId),
                        checkRequired("merchantCategoryCode", merchantCategoryCode),
                        checkRequired("merchantCity", merchantCity),
                        checkRequired("merchantCountry", merchantCountry),
                        checkRequired("merchantName", merchantName),
                        checkRequired("merchantPostalCode", merchantPostalCode),
                        checkRequired("merchantState", merchantState),
                        checkRequired("networkIdentifiers", networkIdentifiers),
                        checkRequired("presentmentAmount", presentmentAmount),
                        checkRequired("presentmentCurrency", presentmentCurrency),
                        checkRequired("purchaseDetails", purchaseDetails),
                        checkRequired("schemeFees", schemeFees).map { it.toImmutable() },
                        checkRequired("transactionId", transactionId),
                        checkRequired("type", type),
                        additionalProperties.toMutableMap(),
                    )
            }

            private var validated: Boolean = false

            /**
             * Validates that the types of all values in this object match their expected types
             * recursively.
             *
             * This method is _not_ forwards compatible with new types from the API for existing
             * fields.
             *
             * @throws IncreaseInvalidDataException if any value type in this object doesn't match
             *   its expected type.
             */
            fun validate(): CardRefund = apply {
                if (validated) {
                    return@apply
                }

                id()
                amount()
                cardPaymentId()
                cashback().ifPresent { it.validate() }
                currency().validate()
                interchange().ifPresent { it.validate() }
                merchantAcceptorId()
                merchantCategoryCode()
                merchantCity()
                merchantCountry()
                merchantName()
                merchantPostalCode()
                merchantState()
                networkIdentifiers().validate()
                presentmentAmount()
                presentmentCurrency()
                purchaseDetails().ifPresent { it.validate() }
                schemeFees().forEach { it.validate() }
                transactionId()
                type().validate()
                validated = true
            }

            fun isValid(): Boolean =
                try {
                    validate()
                    true
                } catch (e: IncreaseInvalidDataException) {
                    false
                }

            /**
             * Returns a score indicating how many valid values are contained in this object
             * recursively.
             *
             * Used for best match union deserialization.
             */
            @JvmSynthetic
            internal fun validity(): Int =
                (if (id.asKnown().isPresent) 1 else 0) +
                    (if (amount.asKnown().isPresent) 1 else 0) +
                    (if (cardPaymentId.asKnown().isPresent) 1 else 0) +
                    (cashback.asKnown().getOrNull()?.validity() ?: 0) +
                    (currency.asKnown().getOrNull()?.validity() ?: 0) +
                    (interchange.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) +
                    (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantCity.asKnown().isPresent) 1 else 0) +
                    (if (merchantCountry.asKnown().isPresent) 1 else 0) +
                    (if (merchantName.asKnown().isPresent) 1 else 0) +
                    (if (merchantPostalCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantState.asKnown().isPresent) 1 else 0) +
                    (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (presentmentAmount.asKnown().isPresent) 1 else 0) +
                    (if (presentmentCurrency.asKnown().isPresent) 1 else 0) +
                    (purchaseDetails.asKnown().getOrNull()?.validity() ?: 0) +
                    (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
                    (if (transactionId.asKnown().isPresent) 1 else 0) +
                    (type.asKnown().getOrNull()?.validity() ?: 0)

            /**
             * Cashback debited for this transaction, if eligible. Cashback is paid out in
             * aggregate, monthly.
             */
            class Cashback
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val amount: JsonField<String>,
                private val currency: JsonField<Currency>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("amount")
                    @ExcludeMissing
                    amount: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("currency")
                    @ExcludeMissing
                    currency: JsonField<Currency> = JsonMissing.of(),
                ) : this(amount, currency, mutableMapOf())

                /**
                 * The cashback amount given as a string containing a decimal number. The amount is
                 * a positive number if it will be credited to you (e.g., settlements) and a
                 * negative number if it will be debited (e.g., refunds).
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun amount(): String = amount.getRequired("amount")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /**
                 * Returns the raw JSON value of [amount].
                 *
                 * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<String> = amount

                /**
                 * Returns the raw JSON value of [currency].
                 *
                 * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun _currency(): JsonField<Currency> = currency

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [Cashback].
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .currency()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [Cashback]. */
                class Builder internal constructor() {

                    private var amount: JsonField<String>? = null
                    private var currency: JsonField<Currency>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(cashback: Cashback) = apply {
                        amount = cashback.amount
                        currency = cashback.currency
                        additionalProperties = cashback.additionalProperties.toMutableMap()
                    }

                    /**
                     * The cashback amount given as a string containing a decimal number. The amount
                     * is a positive number if it will be credited to you (e.g., settlements) and a
                     * negative number if it will be debited (e.g., refunds).
                     */
                    fun amount(amount: String) = amount(JsonField.of(amount))

                    /**
                     * Sets [Builder.amount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.amount] with a well-typed [String] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun amount(amount: JsonField<String>) = apply { this.amount = amount }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * Sets [Builder.currency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.currency] with a well-typed [Currency] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [Cashback].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .currency()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): Cashback =
                        Cashback(
                            checkRequired("amount", amount),
                            checkRequired("currency", currency),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Cashback = apply {
                    if (validated) {
                        return@apply
                    }

                    amount()
                    currency().validate()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (amount.asKnown().isPresent) 1 else 0) +
                        (currency.asKnown().getOrNull()?.validity() ?: 0)

                /** The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. */
                class Currency
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** US Dollar (USD) */
                        @JvmField val USD = of("USD")

                        @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                    }

                    /** An enum containing [Currency]'s known values. */
                    enum class Known {
                        /** US Dollar (USD) */
                        USD
                    }

                    /**
                     * An enum containing [Currency]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Currency] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** US Dollar (USD) */
                        USD,
                        /**
                         * An enum member indicating that [Currency] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            USD -> Value.USD
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            USD -> Known.USD
                            else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Currency = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Currency && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Cashback &&
                        amount == other.amount &&
                        currency == other.currency &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(amount, currency, additionalProperties)
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "Cashback{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
            }

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
             * settlement currency.
             */
            class Currency @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** US Dollar (USD) */
                    @JvmField val USD = of("USD")

                    @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                }

                /** An enum containing [Currency]'s known values. */
                enum class Known {
                    /** US Dollar (USD) */
                    USD
                }

                /**
                 * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Currency] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** US Dollar (USD) */
                    USD,
                    /**
                     * An enum member indicating that [Currency] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        USD -> Value.USD
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        USD -> Known.USD
                        else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Currency = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Currency && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** Interchange assessed as a part of this transaction. */
            class Interchange
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val amount: JsonField<String>,
                private val code: JsonField<String>,
                private val currency: JsonField<Currency>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("amount")
                    @ExcludeMissing
                    amount: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("code")
                    @ExcludeMissing
                    code: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("currency")
                    @ExcludeMissing
                    currency: JsonField<Currency> = JsonMissing.of(),
                ) : this(amount, code, currency, mutableMapOf())

                /**
                 * The interchange amount given as a string containing a decimal number in major
                 * units (so e.g., "3.14" for $3.14). The amount is a positive number if it is
                 * credited to Increase (e.g., settlements) and a negative number if it is debited
                 * (e.g., refunds).
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun amount(): String = amount.getRequired("amount")

                /**
                 * The card network specific interchange code.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun code(): Optional<String> = code.getOptional("code")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the interchange
                 * reimbursement.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /**
                 * Returns the raw JSON value of [amount].
                 *
                 * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<String> = amount

                /**
                 * Returns the raw JSON value of [code].
                 *
                 * Unlike [code], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("code") @ExcludeMissing fun _code(): JsonField<String> = code

                /**
                 * Returns the raw JSON value of [currency].
                 *
                 * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun _currency(): JsonField<Currency> = currency

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [Interchange].
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .code()
                     * .currency()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [Interchange]. */
                class Builder internal constructor() {

                    private var amount: JsonField<String>? = null
                    private var code: JsonField<String>? = null
                    private var currency: JsonField<Currency>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(interchange: Interchange) = apply {
                        amount = interchange.amount
                        code = interchange.code
                        currency = interchange.currency
                        additionalProperties = interchange.additionalProperties.toMutableMap()
                    }

                    /**
                     * The interchange amount given as a string containing a decimal number in major
                     * units (so e.g., "3.14" for $3.14). The amount is a positive number if it is
                     * credited to Increase (e.g., settlements) and a negative number if it is
                     * debited (e.g., refunds).
                     */
                    fun amount(amount: String) = amount(JsonField.of(amount))

                    /**
                     * Sets [Builder.amount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.amount] with a well-typed [String] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun amount(amount: JsonField<String>) = apply { this.amount = amount }

                    /** The card network specific interchange code. */
                    fun code(code: String?) = code(JsonField.ofNullable(code))

                    /** Alias for calling [Builder.code] with `code.orElse(null)`. */
                    fun code(code: Optional<String>) = code(code.getOrNull())

                    /**
                     * Sets [Builder.code] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.code] with a well-typed [String] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun code(code: JsonField<String>) = apply { this.code = code }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * interchange reimbursement.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * Sets [Builder.currency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.currency] with a well-typed [Currency] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [Interchange].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .code()
                     * .currency()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): Interchange =
                        Interchange(
                            checkRequired("amount", amount),
                            checkRequired("code", code),
                            checkRequired("currency", currency),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Interchange = apply {
                    if (validated) {
                        return@apply
                    }

                    amount()
                    code()
                    currency().validate()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (amount.asKnown().isPresent) 1 else 0) +
                        (if (code.asKnown().isPresent) 1 else 0) +
                        (currency.asKnown().getOrNull()?.validity() ?: 0)

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the interchange
                 * reimbursement.
                 */
                class Currency
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** US Dollar (USD) */
                        @JvmField val USD = of("USD")

                        @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                    }

                    /** An enum containing [Currency]'s known values. */
                    enum class Known {
                        /** US Dollar (USD) */
                        USD
                    }

                    /**
                     * An enum containing [Currency]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Currency] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** US Dollar (USD) */
                        USD,
                        /**
                         * An enum member indicating that [Currency] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            USD -> Value.USD
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            USD -> Known.USD
                            else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Currency = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Currency && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Interchange &&
                        amount == other.amount &&
                        code == other.code &&
                        currency == other.currency &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(amount, code, currency, additionalProperties)
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "Interchange{amount=$amount, code=$code, currency=$currency, additionalProperties=$additionalProperties}"
            }

            /** Network-specific identifiers for this refund. */
            class NetworkIdentifiers
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val acquirerBusinessId: JsonField<String>,
                private val acquirerReferenceNumber: JsonField<String>,
                private val authorizationIdentificationResponse: JsonField<String>,
                private val transactionId: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("acquirer_business_id")
                    @ExcludeMissing
                    acquirerBusinessId: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("acquirer_reference_number")
                    @ExcludeMissing
                    acquirerReferenceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("authorization_identification_response")
                    @ExcludeMissing
                    authorizationIdentificationResponse: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("transaction_id")
                    @ExcludeMissing
                    transactionId: JsonField<String> = JsonMissing.of(),
                ) : this(
                    acquirerBusinessId,
                    acquirerReferenceNumber,
                    authorizationIdentificationResponse,
                    transactionId,
                    mutableMapOf(),
                )

                /**
                 * A network assigned business ID that identifies the acquirer that processed this
                 * transaction.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun acquirerBusinessId(): String =
                    acquirerBusinessId.getRequired("acquirer_business_id")

                /**
                 * A globally unique identifier for this settlement.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun acquirerReferenceNumber(): String =
                    acquirerReferenceNumber.getRequired("acquirer_reference_number")

                /**
                 * The randomly generated 6-character Authorization Identification Response code
                 * sent back to the acquirer in an approved response.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun authorizationIdentificationResponse(): Optional<String> =
                    authorizationIdentificationResponse.getOptional(
                        "authorization_identification_response"
                    )

                /**
                 * A globally unique transaction identifier provided by the card network, used
                 * across multiple life-cycle requests.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun transactionId(): Optional<String> = transactionId.getOptional("transaction_id")

                /**
                 * Returns the raw JSON value of [acquirerBusinessId].
                 *
                 * Unlike [acquirerBusinessId], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("acquirer_business_id")
                @ExcludeMissing
                fun _acquirerBusinessId(): JsonField<String> = acquirerBusinessId

                /**
                 * Returns the raw JSON value of [acquirerReferenceNumber].
                 *
                 * Unlike [acquirerReferenceNumber], this method doesn't throw if the JSON field has
                 * an unexpected type.
                 */
                @JsonProperty("acquirer_reference_number")
                @ExcludeMissing
                fun _acquirerReferenceNumber(): JsonField<String> = acquirerReferenceNumber

                /**
                 * Returns the raw JSON value of [authorizationIdentificationResponse].
                 *
                 * Unlike [authorizationIdentificationResponse], this method doesn't throw if the
                 * JSON field has an unexpected type.
                 */
                @JsonProperty("authorization_identification_response")
                @ExcludeMissing
                fun _authorizationIdentificationResponse(): JsonField<String> =
                    authorizationIdentificationResponse

                /**
                 * Returns the raw JSON value of [transactionId].
                 *
                 * Unlike [transactionId], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("transaction_id")
                @ExcludeMissing
                fun _transactionId(): JsonField<String> = transactionId

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of
                     * [NetworkIdentifiers].
                     *
                     * The following fields are required:
                     * ```java
                     * .acquirerBusinessId()
                     * .acquirerReferenceNumber()
                     * .authorizationIdentificationResponse()
                     * .transactionId()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [NetworkIdentifiers]. */
                class Builder internal constructor() {

                    private var acquirerBusinessId: JsonField<String>? = null
                    private var acquirerReferenceNumber: JsonField<String>? = null
                    private var authorizationIdentificationResponse: JsonField<String>? = null
                    private var transactionId: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(networkIdentifiers: NetworkIdentifiers) = apply {
                        acquirerBusinessId = networkIdentifiers.acquirerBusinessId
                        acquirerReferenceNumber = networkIdentifiers.acquirerReferenceNumber
                        authorizationIdentificationResponse =
                            networkIdentifiers.authorizationIdentificationResponse
                        transactionId = networkIdentifiers.transactionId
                        additionalProperties =
                            networkIdentifiers.additionalProperties.toMutableMap()
                    }

                    /**
                     * A network assigned business ID that identifies the acquirer that processed
                     * this transaction.
                     */
                    fun acquirerBusinessId(acquirerBusinessId: String) =
                        acquirerBusinessId(JsonField.of(acquirerBusinessId))

                    /**
                     * Sets [Builder.acquirerBusinessId] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.acquirerBusinessId] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun acquirerBusinessId(acquirerBusinessId: JsonField<String>) = apply {
                        this.acquirerBusinessId = acquirerBusinessId
                    }

                    /** A globally unique identifier for this settlement. */
                    fun acquirerReferenceNumber(acquirerReferenceNumber: String) =
                        acquirerReferenceNumber(JsonField.of(acquirerReferenceNumber))

                    /**
                     * Sets [Builder.acquirerReferenceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.acquirerReferenceNumber] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun acquirerReferenceNumber(acquirerReferenceNumber: JsonField<String>) =
                        apply {
                            this.acquirerReferenceNumber = acquirerReferenceNumber
                        }

                    /**
                     * The randomly generated 6-character Authorization Identification Response code
                     * sent back to the acquirer in an approved response.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: String?
                    ) =
                        authorizationIdentificationResponse(
                            JsonField.ofNullable(authorizationIdentificationResponse)
                        )

                    /**
                     * Alias for calling [Builder.authorizationIdentificationResponse] with
                     * `authorizationIdentificationResponse.orElse(null)`.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: Optional<String>
                    ) =
                        authorizationIdentificationResponse(
                            authorizationIdentificationResponse.getOrNull()
                        )

                    /**
                     * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON
                     * value.
                     *
                     * You should usually call [Builder.authorizationIdentificationResponse] with a
                     * well-typed [String] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: JsonField<String>
                    ) = apply {
                        this.authorizationIdentificationResponse =
                            authorizationIdentificationResponse
                    }

                    /**
                     * A globally unique transaction identifier provided by the card network, used
                     * across multiple life-cycle requests.
                     */
                    fun transactionId(transactionId: String?) =
                        transactionId(JsonField.ofNullable(transactionId))

                    /**
                     * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`.
                     */
                    fun transactionId(transactionId: Optional<String>) =
                        transactionId(transactionId.getOrNull())

                    /**
                     * Sets [Builder.transactionId] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.transactionId] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun transactionId(transactionId: JsonField<String>) = apply {
                        this.transactionId = transactionId
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [NetworkIdentifiers].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .acquirerBusinessId()
                     * .acquirerReferenceNumber()
                     * .authorizationIdentificationResponse()
                     * .transactionId()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): NetworkIdentifiers =
                        NetworkIdentifiers(
                            checkRequired("acquirerBusinessId", acquirerBusinessId),
                            checkRequired("acquirerReferenceNumber", acquirerReferenceNumber),
                            checkRequired(
                                "authorizationIdentificationResponse",
                                authorizationIdentificationResponse,
                            ),
                            checkRequired("transactionId", transactionId),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): NetworkIdentifiers = apply {
                    if (validated) {
                        return@apply
                    }

                    acquirerBusinessId()
                    acquirerReferenceNumber()
                    authorizationIdentificationResponse()
                    transactionId()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (acquirerBusinessId.asKnown().isPresent) 1 else 0) +
                        (if (acquirerReferenceNumber.asKnown().isPresent) 1 else 0) +
                        (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) +
                        (if (transactionId.asKnown().isPresent) 1 else 0)

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is NetworkIdentifiers &&
                        acquirerBusinessId == other.acquirerBusinessId &&
                        acquirerReferenceNumber == other.acquirerReferenceNumber &&
                        authorizationIdentificationResponse ==
                            other.authorizationIdentificationResponse &&
                        transactionId == other.transactionId &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        acquirerBusinessId,
                        acquirerReferenceNumber,
                        authorizationIdentificationResponse,
                        transactionId,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "NetworkIdentifiers{acquirerBusinessId=$acquirerBusinessId, acquirerReferenceNumber=$acquirerReferenceNumber, authorizationIdentificationResponse=$authorizationIdentificationResponse, transactionId=$transactionId, additionalProperties=$additionalProperties}"
            }

            /**
             * Additional details about the card purchase, such as tax and industry-specific fields.
             */
            class PurchaseDetails
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val carRental: JsonField<CarRental>,
                private val customerReferenceIdentifier: JsonField<String>,
                private val localTaxAmount: JsonField<Long>,
                private val localTaxCurrency: JsonField<String>,
                private val lodging: JsonField<Lodging>,
                private val nationalTaxAmount: JsonField<Long>,
                private val nationalTaxCurrency: JsonField<String>,
                private val purchaseIdentifier: JsonField<String>,
                private val purchaseIdentifierFormat: JsonField<PurchaseIdentifierFormat>,
                private val travel: JsonField<Travel>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("car_rental")
                    @ExcludeMissing
                    carRental: JsonField<CarRental> = JsonMissing.of(),
                    @JsonProperty("customer_reference_identifier")
                    @ExcludeMissing
                    customerReferenceIdentifier: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("local_tax_amount")
                    @ExcludeMissing
                    localTaxAmount: JsonField<Long> = JsonMissing.of(),
                    @JsonProperty("local_tax_currency")
                    @ExcludeMissing
                    localTaxCurrency: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("lodging")
                    @ExcludeMissing
                    lodging: JsonField<Lodging> = JsonMissing.of(),
                    @JsonProperty("national_tax_amount")
                    @ExcludeMissing
                    nationalTaxAmount: JsonField<Long> = JsonMissing.of(),
                    @JsonProperty("national_tax_currency")
                    @ExcludeMissing
                    nationalTaxCurrency: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("purchase_identifier")
                    @ExcludeMissing
                    purchaseIdentifier: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("purchase_identifier_format")
                    @ExcludeMissing
                    purchaseIdentifierFormat: JsonField<PurchaseIdentifierFormat> =
                        JsonMissing.of(),
                    @JsonProperty("travel")
                    @ExcludeMissing
                    travel: JsonField<Travel> = JsonMissing.of(),
                ) : this(
                    carRental,
                    customerReferenceIdentifier,
                    localTaxAmount,
                    localTaxCurrency,
                    lodging,
                    nationalTaxAmount,
                    nationalTaxCurrency,
                    purchaseIdentifier,
                    purchaseIdentifierFormat,
                    travel,
                    mutableMapOf(),
                )

                /**
                 * Fields specific to car rentals.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun carRental(): Optional<CarRental> = carRental.getOptional("car_rental")

                /**
                 * An identifier from the merchant for the customer or consumer.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun customerReferenceIdentifier(): Optional<String> =
                    customerReferenceIdentifier.getOptional("customer_reference_identifier")

                /**
                 * The state or provincial tax amount in minor units.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun localTaxAmount(): Optional<Long> =
                    localTaxAmount.getOptional("local_tax_amount")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax
                 * assessed.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun localTaxCurrency(): Optional<String> =
                    localTaxCurrency.getOptional("local_tax_currency")

                /**
                 * Fields specific to lodging.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun lodging(): Optional<Lodging> = lodging.getOptional("lodging")

                /**
                 * The national tax amount in minor units.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun nationalTaxAmount(): Optional<Long> =
                    nationalTaxAmount.getOptional("national_tax_amount")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax
                 * assessed.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun nationalTaxCurrency(): Optional<String> =
                    nationalTaxCurrency.getOptional("national_tax_currency")

                /**
                 * An identifier from the merchant for the purchase to the issuer and cardholder.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun purchaseIdentifier(): Optional<String> =
                    purchaseIdentifier.getOptional("purchase_identifier")

                /**
                 * The format of the purchase identifier.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun purchaseIdentifierFormat(): Optional<PurchaseIdentifierFormat> =
                    purchaseIdentifierFormat.getOptional("purchase_identifier_format")

                /**
                 * Fields specific to travel.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun travel(): Optional<Travel> = travel.getOptional("travel")

                /**
                 * Returns the raw JSON value of [carRental].
                 *
                 * Unlike [carRental], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("car_rental")
                @ExcludeMissing
                fun _carRental(): JsonField<CarRental> = carRental

                /**
                 * Returns the raw JSON value of [customerReferenceIdentifier].
                 *
                 * Unlike [customerReferenceIdentifier], this method doesn't throw if the JSON field
                 * has an unexpected type.
                 */
                @JsonProperty("customer_reference_identifier")
                @ExcludeMissing
                fun _customerReferenceIdentifier(): JsonField<String> = customerReferenceIdentifier

                /**
                 * Returns the raw JSON value of [localTaxAmount].
                 *
                 * Unlike [localTaxAmount], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("local_tax_amount")
                @ExcludeMissing
                fun _localTaxAmount(): JsonField<Long> = localTaxAmount

                /**
                 * Returns the raw JSON value of [localTaxCurrency].
                 *
                 * Unlike [localTaxCurrency], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("local_tax_currency")
                @ExcludeMissing
                fun _localTaxCurrency(): JsonField<String> = localTaxCurrency

                /**
                 * Returns the raw JSON value of [lodging].
                 *
                 * Unlike [lodging], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("lodging")
                @ExcludeMissing
                fun _lodging(): JsonField<Lodging> = lodging

                /**
                 * Returns the raw JSON value of [nationalTaxAmount].
                 *
                 * Unlike [nationalTaxAmount], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("national_tax_amount")
                @ExcludeMissing
                fun _nationalTaxAmount(): JsonField<Long> = nationalTaxAmount

                /**
                 * Returns the raw JSON value of [nationalTaxCurrency].
                 *
                 * Unlike [nationalTaxCurrency], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("national_tax_currency")
                @ExcludeMissing
                fun _nationalTaxCurrency(): JsonField<String> = nationalTaxCurrency

                /**
                 * Returns the raw JSON value of [purchaseIdentifier].
                 *
                 * Unlike [purchaseIdentifier], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("purchase_identifier")
                @ExcludeMissing
                fun _purchaseIdentifier(): JsonField<String> = purchaseIdentifier

                /**
                 * Returns the raw JSON value of [purchaseIdentifierFormat].
                 *
                 * Unlike [purchaseIdentifierFormat], this method doesn't throw if the JSON field
                 * has an unexpected type.
                 */
                @JsonProperty("purchase_identifier_format")
                @ExcludeMissing
                fun _purchaseIdentifierFormat(): JsonField<PurchaseIdentifierFormat> =
                    purchaseIdentifierFormat

                /**
                 * Returns the raw JSON value of [travel].
                 *
                 * Unlike [travel], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("travel") @ExcludeMissing fun _travel(): JsonField<Travel> = travel

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [PurchaseDetails].
                     *
                     * The following fields are required:
                     * ```java
                     * .carRental()
                     * .customerReferenceIdentifier()
                     * .localTaxAmount()
                     * .localTaxCurrency()
                     * .lodging()
                     * .nationalTaxAmount()
                     * .nationalTaxCurrency()
                     * .purchaseIdentifier()
                     * .purchaseIdentifierFormat()
                     * .travel()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [PurchaseDetails]. */
                class Builder internal constructor() {

                    private var carRental: JsonField<CarRental>? = null
                    private var customerReferenceIdentifier: JsonField<String>? = null
                    private var localTaxAmount: JsonField<Long>? = null
                    private var localTaxCurrency: JsonField<String>? = null
                    private var lodging: JsonField<Lodging>? = null
                    private var nationalTaxAmount: JsonField<Long>? = null
                    private var nationalTaxCurrency: JsonField<String>? = null
                    private var purchaseIdentifier: JsonField<String>? = null
                    private var purchaseIdentifierFormat: JsonField<PurchaseIdentifierFormat>? =
                        null
                    private var travel: JsonField<Travel>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(purchaseDetails: PurchaseDetails) = apply {
                        carRental = purchaseDetails.carRental
                        customerReferenceIdentifier = purchaseDetails.customerReferenceIdentifier
                        localTaxAmount = purchaseDetails.localTaxAmount
                        localTaxCurrency = purchaseDetails.localTaxCurrency
                        lodging = purchaseDetails.lodging
                        nationalTaxAmount = purchaseDetails.nationalTaxAmount
                        nationalTaxCurrency = purchaseDetails.nationalTaxCurrency
                        purchaseIdentifier = purchaseDetails.purchaseIdentifier
                        purchaseIdentifierFormat = purchaseDetails.purchaseIdentifierFormat
                        travel = purchaseDetails.travel
                        additionalProperties = purchaseDetails.additionalProperties.toMutableMap()
                    }

                    /** Fields specific to car rentals. */
                    fun carRental(carRental: CarRental?) =
                        carRental(JsonField.ofNullable(carRental))

                    /** Alias for calling [Builder.carRental] with `carRental.orElse(null)`. */
                    fun carRental(carRental: Optional<CarRental>) = carRental(carRental.getOrNull())

                    /**
                     * Sets [Builder.carRental] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.carRental] with a well-typed [CarRental]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun carRental(carRental: JsonField<CarRental>) = apply {
                        this.carRental = carRental
                    }

                    /** An identifier from the merchant for the customer or consumer. */
                    fun customerReferenceIdentifier(customerReferenceIdentifier: String?) =
                        customerReferenceIdentifier(
                            JsonField.ofNullable(customerReferenceIdentifier)
                        )

                    /**
                     * Alias for calling [Builder.customerReferenceIdentifier] with
                     * `customerReferenceIdentifier.orElse(null)`.
                     */
                    fun customerReferenceIdentifier(customerReferenceIdentifier: Optional<String>) =
                        customerReferenceIdentifier(customerReferenceIdentifier.getOrNull())

                    /**
                     * Sets [Builder.customerReferenceIdentifier] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.customerReferenceIdentifier] with a
                     * well-typed [String] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun customerReferenceIdentifier(
                        customerReferenceIdentifier: JsonField<String>
                    ) = apply { this.customerReferenceIdentifier = customerReferenceIdentifier }

                    /** The state or provincial tax amount in minor units. */
                    fun localTaxAmount(localTaxAmount: Long?) =
                        localTaxAmount(JsonField.ofNullable(localTaxAmount))

                    /**
                     * Alias for [Builder.localTaxAmount].
                     *
                     * This unboxed primitive overload exists for backwards compatibility.
                     */
                    fun localTaxAmount(localTaxAmount: Long) =
                        localTaxAmount(localTaxAmount as Long?)

                    /**
                     * Alias for calling [Builder.localTaxAmount] with
                     * `localTaxAmount.orElse(null)`.
                     */
                    fun localTaxAmount(localTaxAmount: Optional<Long>) =
                        localTaxAmount(localTaxAmount.getOrNull())

                    /**
                     * Sets [Builder.localTaxAmount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.localTaxAmount] with a well-typed [Long]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun localTaxAmount(localTaxAmount: JsonField<Long>) = apply {
                        this.localTaxAmount = localTaxAmount
                    }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax
                     * assessed.
                     */
                    fun localTaxCurrency(localTaxCurrency: String?) =
                        localTaxCurrency(JsonField.ofNullable(localTaxCurrency))

                    /**
                     * Alias for calling [Builder.localTaxCurrency] with
                     * `localTaxCurrency.orElse(null)`.
                     */
                    fun localTaxCurrency(localTaxCurrency: Optional<String>) =
                        localTaxCurrency(localTaxCurrency.getOrNull())

                    /**
                     * Sets [Builder.localTaxCurrency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.localTaxCurrency] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun localTaxCurrency(localTaxCurrency: JsonField<String>) = apply {
                        this.localTaxCurrency = localTaxCurrency
                    }

                    /** Fields specific to lodging. */
                    fun lodging(lodging: Lodging?) = lodging(JsonField.ofNullable(lodging))

                    /** Alias for calling [Builder.lodging] with `lodging.orElse(null)`. */
                    fun lodging(lodging: Optional<Lodging>) = lodging(lodging.getOrNull())

                    /**
                     * Sets [Builder.lodging] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.lodging] with a well-typed [Lodging] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun lodging(lodging: JsonField<Lodging>) = apply { this.lodging = lodging }

                    /** The national tax amount in minor units. */
                    fun nationalTaxAmount(nationalTaxAmount: Long?) =
                        nationalTaxAmount(JsonField.ofNullable(nationalTaxAmount))

                    /**
                     * Alias for [Builder.nationalTaxAmount].
                     *
                     * This unboxed primitive overload exists for backwards compatibility.
                     */
                    fun nationalTaxAmount(nationalTaxAmount: Long) =
                        nationalTaxAmount(nationalTaxAmount as Long?)

                    /**
                     * Alias for calling [Builder.nationalTaxAmount] with
                     * `nationalTaxAmount.orElse(null)`.
                     */
                    fun nationalTaxAmount(nationalTaxAmount: Optional<Long>) =
                        nationalTaxAmount(nationalTaxAmount.getOrNull())

                    /**
                     * Sets [Builder.nationalTaxAmount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.nationalTaxAmount] with a well-typed [Long]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun nationalTaxAmount(nationalTaxAmount: JsonField<Long>) = apply {
                        this.nationalTaxAmount = nationalTaxAmount
                    }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax
                     * assessed.
                     */
                    fun nationalTaxCurrency(nationalTaxCurrency: String?) =
                        nationalTaxCurrency(JsonField.ofNullable(nationalTaxCurrency))

                    /**
                     * Alias for calling [Builder.nationalTaxCurrency] with
                     * `nationalTaxCurrency.orElse(null)`.
                     */
                    fun nationalTaxCurrency(nationalTaxCurrency: Optional<String>) =
                        nationalTaxCurrency(nationalTaxCurrency.getOrNull())

                    /**
                     * Sets [Builder.nationalTaxCurrency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.nationalTaxCurrency] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun nationalTaxCurrency(nationalTaxCurrency: JsonField<String>) = apply {
                        this.nationalTaxCurrency = nationalTaxCurrency
                    }

                    /**
                     * An identifier from the merchant for the purchase to the issuer and
                     * cardholder.
                     */
                    fun purchaseIdentifier(purchaseIdentifier: String?) =
                        purchaseIdentifier(JsonField.ofNullable(purchaseIdentifier))

                    /**
                     * Alias for calling [Builder.purchaseIdentifier] with
                     * `purchaseIdentifier.orElse(null)`.
                     */
                    fun purchaseIdentifier(purchaseIdentifier: Optional<String>) =
                        purchaseIdentifier(purchaseIdentifier.getOrNull())

                    /**
                     * Sets [Builder.purchaseIdentifier] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.purchaseIdentifier] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun purchaseIdentifier(purchaseIdentifier: JsonField<String>) = apply {
                        this.purchaseIdentifier = purchaseIdentifier
                    }

                    /** The format of the purchase identifier. */
                    fun purchaseIdentifierFormat(
                        purchaseIdentifierFormat: PurchaseIdentifierFormat?
                    ) = purchaseIdentifierFormat(JsonField.ofNullable(purchaseIdentifierFormat))

                    /**
                     * Alias for calling [Builder.purchaseIdentifierFormat] with
                     * `purchaseIdentifierFormat.orElse(null)`.
                     */
                    fun purchaseIdentifierFormat(
                        purchaseIdentifierFormat: Optional<PurchaseIdentifierFormat>
                    ) = purchaseIdentifierFormat(purchaseIdentifierFormat.getOrNull())

                    /**
                     * Sets [Builder.purchaseIdentifierFormat] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.purchaseIdentifierFormat] with a well-typed
                     * [PurchaseIdentifierFormat] value instead. This method is primarily for
                     * setting the field to an undocumented or not yet supported value.
                     */
                    fun purchaseIdentifierFormat(
                        purchaseIdentifierFormat: JsonField<PurchaseIdentifierFormat>
                    ) = apply { this.purchaseIdentifierFormat = purchaseIdentifierFormat }

                    /** Fields specific to travel. */
                    fun travel(travel: Travel?) = travel(JsonField.ofNullable(travel))

                    /** Alias for calling [Builder.travel] with `travel.orElse(null)`. */
                    fun travel(travel: Optional<Travel>) = travel(travel.getOrNull())

                    /**
                     * Sets [Builder.travel] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.travel] with a well-typed [Travel] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun travel(travel: JsonField<Travel>) = apply { this.travel = travel }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [PurchaseDetails].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .carRental()
                     * .customerReferenceIdentifier()
                     * .localTaxAmount()
                     * .localTaxCurrency()
                     * .lodging()
                     * .nationalTaxAmount()
                     * .nationalTaxCurrency()
                     * .purchaseIdentifier()
                     * .purchaseIdentifierFormat()
                     * .travel()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): PurchaseDetails =
                        PurchaseDetails(
                            checkRequired("carRental", carRental),
                            checkRequired(
                                "customerReferenceIdentifier",
                                customerReferenceIdentifier,
                            ),
                            checkRequired("localTaxAmount", localTaxAmount),
                            checkRequired("localTaxCurrency", localTaxCurrency),
                            checkRequired("lodging", lodging),
                            checkRequired("nationalTaxAmount", nationalTaxAmount),
                            checkRequired("nationalTaxCurrency", nationalTaxCurrency),
                            checkRequired("purchaseIdentifier", purchaseIdentifier),
                            checkRequired("purchaseIdentifierFormat", purchaseIdentifierFormat),
                            checkRequired("travel", travel),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): PurchaseDetails = apply {
                    if (validated) {
                        return@apply
                    }

                    carRental().ifPresent { it.validate() }
                    customerReferenceIdentifier()
                    localTaxAmount()
                    localTaxCurrency()
                    lodging().ifPresent { it.validate() }
                    nationalTaxAmount()
                    nationalTaxCurrency()
                    purchaseIdentifier()
                    purchaseIdentifierFormat().ifPresent { it.validate() }
                    travel().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (carRental.asKnown().getOrNull()?.validity() ?: 0) +
                        (if (customerReferenceIdentifier.asKnown().isPresent) 1 else 0) +
                        (if (localTaxAmount.asKnown().isPresent) 1 else 0) +
                        (if (localTaxCurrency.asKnown().isPresent) 1 else 0) +
                        (lodging.asKnown().getOrNull()?.validity() ?: 0) +
                        (if (nationalTaxAmount.asKnown().isPresent) 1 else 0) +
                        (if (nationalTaxCurrency.asKnown().isPresent) 1 else 0) +
                        (if (purchaseIdentifier.asKnown().isPresent) 1 else 0) +
                        (purchaseIdentifierFormat.asKnown().getOrNull()?.validity() ?: 0) +
                        (travel.asKnown().getOrNull()?.validity() ?: 0)

                /** Fields specific to car rentals. */
                class CarRental
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val carClassCode: JsonField<String>,
                    private val checkoutDate: JsonField<LocalDate>,
                    private val dailyRentalRateAmount: JsonField<Long>,
                    private val dailyRentalRateCurrency: JsonField<String>,
                    private val daysRented: JsonField<Long>,
                    private val extraCharges: JsonField<ExtraCharges>,
                    private val fuelChargesAmount: JsonField<Long>,
                    private val fuelChargesCurrency: JsonField<String>,
                    private val insuranceChargesAmount: JsonField<Long>,
                    private val insuranceChargesCurrency: JsonField<String>,
                    private val noShowIndicator: JsonField<NoShowIndicator>,
                    private val oneWayDropOffChargesAmount: JsonField<Long>,
                    private val oneWayDropOffChargesCurrency: JsonField<String>,
                    private val renterName: JsonField<String>,
                    private val weeklyRentalRateAmount: JsonField<Long>,
                    private val weeklyRentalRateCurrency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("car_class_code")
                        @ExcludeMissing
                        carClassCode: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("checkout_date")
                        @ExcludeMissing
                        checkoutDate: JsonField<LocalDate> = JsonMissing.of(),
                        @JsonProperty("daily_rental_rate_amount")
                        @ExcludeMissing
                        dailyRentalRateAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("daily_rental_rate_currency")
                        @ExcludeMissing
                        dailyRentalRateCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("days_rented")
                        @ExcludeMissing
                        daysRented: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("extra_charges")
                        @ExcludeMissing
                        extraCharges: JsonField<ExtraCharges> = JsonMissing.of(),
                        @JsonProperty("fuel_charges_amount")
                        @ExcludeMissing
                        fuelChargesAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("fuel_charges_currency")
                        @ExcludeMissing
                        fuelChargesCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("insurance_charges_amount")
                        @ExcludeMissing
                        insuranceChargesAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("insurance_charges_currency")
                        @ExcludeMissing
                        insuranceChargesCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("no_show_indicator")
                        @ExcludeMissing
                        noShowIndicator: JsonField<NoShowIndicator> = JsonMissing.of(),
                        @JsonProperty("one_way_drop_off_charges_amount")
                        @ExcludeMissing
                        oneWayDropOffChargesAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("one_way_drop_off_charges_currency")
                        @ExcludeMissing
                        oneWayDropOffChargesCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("renter_name")
                        @ExcludeMissing
                        renterName: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("weekly_rental_rate_amount")
                        @ExcludeMissing
                        weeklyRentalRateAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("weekly_rental_rate_currency")
                        @ExcludeMissing
                        weeklyRentalRateCurrency: JsonField<String> = JsonMissing.of(),
                    ) : this(
                        carClassCode,
                        checkoutDate,
                        dailyRentalRateAmount,
                        dailyRentalRateCurrency,
                        daysRented,
                        extraCharges,
                        fuelChargesAmount,
                        fuelChargesCurrency,
                        insuranceChargesAmount,
                        insuranceChargesCurrency,
                        noShowIndicator,
                        oneWayDropOffChargesAmount,
                        oneWayDropOffChargesCurrency,
                        renterName,
                        weeklyRentalRateAmount,
                        weeklyRentalRateCurrency,
                        mutableMapOf(),
                    )

                    /**
                     * Code indicating the vehicle's class.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun carClassCode(): Optional<String> =
                        carClassCode.getOptional("car_class_code")

                    /**
                     * Date the customer picked up the car or, in the case of a no-show or pre-pay
                     * transaction, the scheduled pick up date.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun checkoutDate(): Optional<LocalDate> =
                        checkoutDate.getOptional("checkout_date")

                    /**
                     * Daily rate being charged for the vehicle.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun dailyRentalRateAmount(): Optional<Long> =
                        dailyRentalRateAmount.getOptional("daily_rental_rate_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily
                     * rental rate.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun dailyRentalRateCurrency(): Optional<String> =
                        dailyRentalRateCurrency.getOptional("daily_rental_rate_currency")

                    /**
                     * Number of days the vehicle was rented.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun daysRented(): Optional<Long> = daysRented.getOptional("days_rented")

                    /**
                     * Additional charges (gas, late fee, etc.) being billed.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun extraCharges(): Optional<ExtraCharges> =
                        extraCharges.getOptional("extra_charges")

                    /**
                     * Fuel charges for the vehicle.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun fuelChargesAmount(): Optional<Long> =
                        fuelChargesAmount.getOptional("fuel_charges_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel
                     * charges assessed.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun fuelChargesCurrency(): Optional<String> =
                        fuelChargesCurrency.getOptional("fuel_charges_currency")

                    /**
                     * Any insurance being charged for the vehicle.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun insuranceChargesAmount(): Optional<Long> =
                        insuranceChargesAmount.getOptional("insurance_charges_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the insurance
                     * charges assessed.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun insuranceChargesCurrency(): Optional<String> =
                        insuranceChargesCurrency.getOptional("insurance_charges_currency")

                    /**
                     * An indicator that the cardholder is being billed for a reserved vehicle that
                     * was not actually rented (that is, a "no-show" charge).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun noShowIndicator(): Optional<NoShowIndicator> =
                        noShowIndicator.getOptional("no_show_indicator")

                    /**
                     * Charges for returning the vehicle at a different location than where it was
                     * picked up.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun oneWayDropOffChargesAmount(): Optional<Long> =
                        oneWayDropOffChargesAmount.getOptional("one_way_drop_off_charges_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the one-way
                     * drop-off charges assessed.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun oneWayDropOffChargesCurrency(): Optional<String> =
                        oneWayDropOffChargesCurrency.getOptional(
                            "one_way_drop_off_charges_currency"
                        )

                    /**
                     * Name of the person renting the vehicle.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun renterName(): Optional<String> = renterName.getOptional("renter_name")

                    /**
                     * Weekly rate being charged for the vehicle.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun weeklyRentalRateAmount(): Optional<Long> =
                        weeklyRentalRateAmount.getOptional("weekly_rental_rate_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the weekly
                     * rental rate.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun weeklyRentalRateCurrency(): Optional<String> =
                        weeklyRentalRateCurrency.getOptional("weekly_rental_rate_currency")

                    /**
                     * Returns the raw JSON value of [carClassCode].
                     *
                     * Unlike [carClassCode], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("car_class_code")
                    @ExcludeMissing
                    fun _carClassCode(): JsonField<String> = carClassCode

                    /**
                     * Returns the raw JSON value of [checkoutDate].
                     *
                     * Unlike [checkoutDate], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("checkout_date")
                    @ExcludeMissing
                    fun _checkoutDate(): JsonField<LocalDate> = checkoutDate

                    /**
                     * Returns the raw JSON value of [dailyRentalRateAmount].
                     *
                     * Unlike [dailyRentalRateAmount], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("daily_rental_rate_amount")
                    @ExcludeMissing
                    fun _dailyRentalRateAmount(): JsonField<Long> = dailyRentalRateAmount

                    /**
                     * Returns the raw JSON value of [dailyRentalRateCurrency].
                     *
                     * Unlike [dailyRentalRateCurrency], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("daily_rental_rate_currency")
                    @ExcludeMissing
                    fun _dailyRentalRateCurrency(): JsonField<String> = dailyRentalRateCurrency

                    /**
                     * Returns the raw JSON value of [daysRented].
                     *
                     * Unlike [daysRented], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("days_rented")
                    @ExcludeMissing
                    fun _daysRented(): JsonField<Long> = daysRented

                    /**
                     * Returns the raw JSON value of [extraCharges].
                     *
                     * Unlike [extraCharges], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("extra_charges")
                    @ExcludeMissing
                    fun _extraCharges(): JsonField<ExtraCharges> = extraCharges

                    /**
                     * Returns the raw JSON value of [fuelChargesAmount].
                     *
                     * Unlike [fuelChargesAmount], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("fuel_charges_amount")
                    @ExcludeMissing
                    fun _fuelChargesAmount(): JsonField<Long> = fuelChargesAmount

                    /**
                     * Returns the raw JSON value of [fuelChargesCurrency].
                     *
                     * Unlike [fuelChargesCurrency], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("fuel_charges_currency")
                    @ExcludeMissing
                    fun _fuelChargesCurrency(): JsonField<String> = fuelChargesCurrency

                    /**
                     * Returns the raw JSON value of [insuranceChargesAmount].
                     *
                     * Unlike [insuranceChargesAmount], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("insurance_charges_amount")
                    @ExcludeMissing
                    fun _insuranceChargesAmount(): JsonField<Long> = insuranceChargesAmount

                    /**
                     * Returns the raw JSON value of [insuranceChargesCurrency].
                     *
                     * Unlike [insuranceChargesCurrency], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("insurance_charges_currency")
                    @ExcludeMissing
                    fun _insuranceChargesCurrency(): JsonField<String> = insuranceChargesCurrency

                    /**
                     * Returns the raw JSON value of [noShowIndicator].
                     *
                     * Unlike [noShowIndicator], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("no_show_indicator")
                    @ExcludeMissing
                    fun _noShowIndicator(): JsonField<NoShowIndicator> = noShowIndicator

                    /**
                     * Returns the raw JSON value of [oneWayDropOffChargesAmount].
                     *
                     * Unlike [oneWayDropOffChargesAmount], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("one_way_drop_off_charges_amount")
                    @ExcludeMissing
                    fun _oneWayDropOffChargesAmount(): JsonField<Long> = oneWayDropOffChargesAmount

                    /**
                     * Returns the raw JSON value of [oneWayDropOffChargesCurrency].
                     *
                     * Unlike [oneWayDropOffChargesCurrency], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("one_way_drop_off_charges_currency")
                    @ExcludeMissing
                    fun _oneWayDropOffChargesCurrency(): JsonField<String> =
                        oneWayDropOffChargesCurrency

                    /**
                     * Returns the raw JSON value of [renterName].
                     *
                     * Unlike [renterName], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("renter_name")
                    @ExcludeMissing
                    fun _renterName(): JsonField<String> = renterName

                    /**
                     * Returns the raw JSON value of [weeklyRentalRateAmount].
                     *
                     * Unlike [weeklyRentalRateAmount], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("weekly_rental_rate_amount")
                    @ExcludeMissing
                    fun _weeklyRentalRateAmount(): JsonField<Long> = weeklyRentalRateAmount

                    /**
                     * Returns the raw JSON value of [weeklyRentalRateCurrency].
                     *
                     * Unlike [weeklyRentalRateCurrency], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("weekly_rental_rate_currency")
                    @ExcludeMissing
                    fun _weeklyRentalRateCurrency(): JsonField<String> = weeklyRentalRateCurrency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [CarRental].
                         *
                         * The following fields are required:
                         * ```java
                         * .carClassCode()
                         * .checkoutDate()
                         * .dailyRentalRateAmount()
                         * .dailyRentalRateCurrency()
                         * .daysRented()
                         * .extraCharges()
                         * .fuelChargesAmount()
                         * .fuelChargesCurrency()
                         * .insuranceChargesAmount()
                         * .insuranceChargesCurrency()
                         * .noShowIndicator()
                         * .oneWayDropOffChargesAmount()
                         * .oneWayDropOffChargesCurrency()
                         * .renterName()
                         * .weeklyRentalRateAmount()
                         * .weeklyRentalRateCurrency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CarRental]. */
                    class Builder internal constructor() {

                        private var carClassCode: JsonField<String>? = null
                        private var checkoutDate: JsonField<LocalDate>? = null
                        private var dailyRentalRateAmount: JsonField<Long>? = null
                        private var dailyRentalRateCurrency: JsonField<String>? = null
                        private var daysRented: JsonField<Long>? = null
                        private var extraCharges: JsonField<ExtraCharges>? = null
                        private var fuelChargesAmount: JsonField<Long>? = null
                        private var fuelChargesCurrency: JsonField<String>? = null
                        private var insuranceChargesAmount: JsonField<Long>? = null
                        private var insuranceChargesCurrency: JsonField<String>? = null
                        private var noShowIndicator: JsonField<NoShowIndicator>? = null
                        private var oneWayDropOffChargesAmount: JsonField<Long>? = null
                        private var oneWayDropOffChargesCurrency: JsonField<String>? = null
                        private var renterName: JsonField<String>? = null
                        private var weeklyRentalRateAmount: JsonField<Long>? = null
                        private var weeklyRentalRateCurrency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(carRental: CarRental) = apply {
                            carClassCode = carRental.carClassCode
                            checkoutDate = carRental.checkoutDate
                            dailyRentalRateAmount = carRental.dailyRentalRateAmount
                            dailyRentalRateCurrency = carRental.dailyRentalRateCurrency
                            daysRented = carRental.daysRented
                            extraCharges = carRental.extraCharges
                            fuelChargesAmount = carRental.fuelChargesAmount
                            fuelChargesCurrency = carRental.fuelChargesCurrency
                            insuranceChargesAmount = carRental.insuranceChargesAmount
                            insuranceChargesCurrency = carRental.insuranceChargesCurrency
                            noShowIndicator = carRental.noShowIndicator
                            oneWayDropOffChargesAmount = carRental.oneWayDropOffChargesAmount
                            oneWayDropOffChargesCurrency = carRental.oneWayDropOffChargesCurrency
                            renterName = carRental.renterName
                            weeklyRentalRateAmount = carRental.weeklyRentalRateAmount
                            weeklyRentalRateCurrency = carRental.weeklyRentalRateCurrency
                            additionalProperties = carRental.additionalProperties.toMutableMap()
                        }

                        /** Code indicating the vehicle's class. */
                        fun carClassCode(carClassCode: String?) =
                            carClassCode(JsonField.ofNullable(carClassCode))

                        /**
                         * Alias for calling [Builder.carClassCode] with
                         * `carClassCode.orElse(null)`.
                         */
                        fun carClassCode(carClassCode: Optional<String>) =
                            carClassCode(carClassCode.getOrNull())

                        /**
                         * Sets [Builder.carClassCode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.carClassCode] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun carClassCode(carClassCode: JsonField<String>) = apply {
                            this.carClassCode = carClassCode
                        }

                        /**
                         * Date the customer picked up the car or, in the case of a no-show or
                         * pre-pay transaction, the scheduled pick up date.
                         */
                        fun checkoutDate(checkoutDate: LocalDate?) =
                            checkoutDate(JsonField.ofNullable(checkoutDate))

                        /**
                         * Alias for calling [Builder.checkoutDate] with
                         * `checkoutDate.orElse(null)`.
                         */
                        fun checkoutDate(checkoutDate: Optional<LocalDate>) =
                            checkoutDate(checkoutDate.getOrNull())

                        /**
                         * Sets [Builder.checkoutDate] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.checkoutDate] with a well-typed
                         * [LocalDate] value instead. This method is primarily for setting the field
                         * to an undocumented or not yet supported value.
                         */
                        fun checkoutDate(checkoutDate: JsonField<LocalDate>) = apply {
                            this.checkoutDate = checkoutDate
                        }

                        /** Daily rate being charged for the vehicle. */
                        fun dailyRentalRateAmount(dailyRentalRateAmount: Long?) =
                            dailyRentalRateAmount(JsonField.ofNullable(dailyRentalRateAmount))

                        /**
                         * Alias for [Builder.dailyRentalRateAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun dailyRentalRateAmount(dailyRentalRateAmount: Long) =
                            dailyRentalRateAmount(dailyRentalRateAmount as Long?)

                        /**
                         * Alias for calling [Builder.dailyRentalRateAmount] with
                         * `dailyRentalRateAmount.orElse(null)`.
                         */
                        fun dailyRentalRateAmount(dailyRentalRateAmount: Optional<Long>) =
                            dailyRentalRateAmount(dailyRentalRateAmount.getOrNull())

                        /**
                         * Sets [Builder.dailyRentalRateAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.dailyRentalRateAmount] with a well-typed
                         * [Long] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun dailyRentalRateAmount(dailyRentalRateAmount: JsonField<Long>) = apply {
                            this.dailyRentalRateAmount = dailyRentalRateAmount
                        }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily
                         * rental rate.
                         */
                        fun dailyRentalRateCurrency(dailyRentalRateCurrency: String?) =
                            dailyRentalRateCurrency(JsonField.ofNullable(dailyRentalRateCurrency))

                        /**
                         * Alias for calling [Builder.dailyRentalRateCurrency] with
                         * `dailyRentalRateCurrency.orElse(null)`.
                         */
                        fun dailyRentalRateCurrency(dailyRentalRateCurrency: Optional<String>) =
                            dailyRentalRateCurrency(dailyRentalRateCurrency.getOrNull())

                        /**
                         * Sets [Builder.dailyRentalRateCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.dailyRentalRateCurrency] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun dailyRentalRateCurrency(dailyRentalRateCurrency: JsonField<String>) =
                            apply {
                                this.dailyRentalRateCurrency = dailyRentalRateCurrency
                            }

                        /** Number of days the vehicle was rented. */
                        fun daysRented(daysRented: Long?) =
                            daysRented(JsonField.ofNullable(daysRented))

                        /**
                         * Alias for [Builder.daysRented].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun daysRented(daysRented: Long) = daysRented(daysRented as Long?)

                        /**
                         * Alias for calling [Builder.daysRented] with `daysRented.orElse(null)`.
                         */
                        fun daysRented(daysRented: Optional<Long>) =
                            daysRented(daysRented.getOrNull())

                        /**
                         * Sets [Builder.daysRented] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.daysRented] with a well-typed [Long]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun daysRented(daysRented: JsonField<Long>) = apply {
                            this.daysRented = daysRented
                        }

                        /** Additional charges (gas, late fee, etc.) being billed. */
                        fun extraCharges(extraCharges: ExtraCharges?) =
                            extraCharges(JsonField.ofNullable(extraCharges))

                        /**
                         * Alias for calling [Builder.extraCharges] with
                         * `extraCharges.orElse(null)`.
                         */
                        fun extraCharges(extraCharges: Optional<ExtraCharges>) =
                            extraCharges(extraCharges.getOrNull())

                        /**
                         * Sets [Builder.extraCharges] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.extraCharges] with a well-typed
                         * [ExtraCharges] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun extraCharges(extraCharges: JsonField<ExtraCharges>) = apply {
                            this.extraCharges = extraCharges
                        }

                        /** Fuel charges for the vehicle. */
                        fun fuelChargesAmount(fuelChargesAmount: Long?) =
                            fuelChargesAmount(JsonField.ofNullable(fuelChargesAmount))

                        /**
                         * Alias for [Builder.fuelChargesAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun fuelChargesAmount(fuelChargesAmount: Long) =
                            fuelChargesAmount(fuelChargesAmount as Long?)

                        /**
                         * Alias for calling [Builder.fuelChargesAmount] with
                         * `fuelChargesAmount.orElse(null)`.
                         */
                        fun fuelChargesAmount(fuelChargesAmount: Optional<Long>) =
                            fuelChargesAmount(fuelChargesAmount.getOrNull())

                        /**
                         * Sets [Builder.fuelChargesAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.fuelChargesAmount] with a well-typed
                         * [Long] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun fuelChargesAmount(fuelChargesAmount: JsonField<Long>) = apply {
                            this.fuelChargesAmount = fuelChargesAmount
                        }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel
                         * charges assessed.
                         */
                        fun fuelChargesCurrency(fuelChargesCurrency: String?) =
                            fuelChargesCurrency(JsonField.ofNullable(fuelChargesCurrency))

                        /**
                         * Alias for calling [Builder.fuelChargesCurrency] with
                         * `fuelChargesCurrency.orElse(null)`.
                         */
                        fun fuelChargesCurrency(fuelChargesCurrency: Optional<String>) =
                            fuelChargesCurrency(fuelChargesCurrency.getOrNull())

                        /**
                         * Sets [Builder.fuelChargesCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.fuelChargesCurrency] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun fuelChargesCurrency(fuelChargesCurrency: JsonField<String>) = apply {
                            this.fuelChargesCurrency = fuelChargesCurrency
                        }

                        /** Any insurance being charged for the vehicle. */
                        fun insuranceChargesAmount(insuranceChargesAmount: Long?) =
                            insuranceChargesAmount(JsonField.ofNullable(insuranceChargesAmount))

                        /**
                         * Alias for [Builder.insuranceChargesAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun insuranceChargesAmount(insuranceChargesAmount: Long) =
                            insuranceChargesAmount(insuranceChargesAmount as Long?)

                        /**
                         * Alias for calling [Builder.insuranceChargesAmount] with
                         * `insuranceChargesAmount.orElse(null)`.
                         */
                        fun insuranceChargesAmount(insuranceChargesAmount: Optional<Long>) =
                            insuranceChargesAmount(insuranceChargesAmount.getOrNull())

                        /**
                         * Sets [Builder.insuranceChargesAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.insuranceChargesAmount] with a
                         * well-typed [Long] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun insuranceChargesAmount(insuranceChargesAmount: JsonField<Long>) =
                            apply {
                                this.insuranceChargesAmount = insuranceChargesAmount
                            }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * insurance charges assessed.
                         */
                        fun insuranceChargesCurrency(insuranceChargesCurrency: String?) =
                            insuranceChargesCurrency(JsonField.ofNullable(insuranceChargesCurrency))

                        /**
                         * Alias for calling [Builder.insuranceChargesCurrency] with
                         * `insuranceChargesCurrency.orElse(null)`.
                         */
                        fun insuranceChargesCurrency(insuranceChargesCurrency: Optional<String>) =
                            insuranceChargesCurrency(insuranceChargesCurrency.getOrNull())

                        /**
                         * Sets [Builder.insuranceChargesCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.insuranceChargesCurrency] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun insuranceChargesCurrency(insuranceChargesCurrency: JsonField<String>) =
                            apply {
                                this.insuranceChargesCurrency = insuranceChargesCurrency
                            }

                        /**
                         * An indicator that the cardholder is being billed for a reserved vehicle
                         * that was not actually rented (that is, a "no-show" charge).
                         */
                        fun noShowIndicator(noShowIndicator: NoShowIndicator?) =
                            noShowIndicator(JsonField.ofNullable(noShowIndicator))

                        /**
                         * Alias for calling [Builder.noShowIndicator] with
                         * `noShowIndicator.orElse(null)`.
                         */
                        fun noShowIndicator(noShowIndicator: Optional<NoShowIndicator>) =
                            noShowIndicator(noShowIndicator.getOrNull())

                        /**
                         * Sets [Builder.noShowIndicator] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.noShowIndicator] with a well-typed
                         * [NoShowIndicator] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun noShowIndicator(noShowIndicator: JsonField<NoShowIndicator>) = apply {
                            this.noShowIndicator = noShowIndicator
                        }

                        /**
                         * Charges for returning the vehicle at a different location than where it
                         * was picked up.
                         */
                        fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long?) =
                            oneWayDropOffChargesAmount(
                                JsonField.ofNullable(oneWayDropOffChargesAmount)
                            )

                        /**
                         * Alias for [Builder.oneWayDropOffChargesAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long) =
                            oneWayDropOffChargesAmount(oneWayDropOffChargesAmount as Long?)

                        /**
                         * Alias for calling [Builder.oneWayDropOffChargesAmount] with
                         * `oneWayDropOffChargesAmount.orElse(null)`.
                         */
                        fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Optional<Long>) =
                            oneWayDropOffChargesAmount(oneWayDropOffChargesAmount.getOrNull())

                        /**
                         * Sets [Builder.oneWayDropOffChargesAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.oneWayDropOffChargesAmount] with a
                         * well-typed [Long] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun oneWayDropOffChargesAmount(
                            oneWayDropOffChargesAmount: JsonField<Long>
                        ) = apply { this.oneWayDropOffChargesAmount = oneWayDropOffChargesAmount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * one-way drop-off charges assessed.
                         */
                        fun oneWayDropOffChargesCurrency(oneWayDropOffChargesCurrency: String?) =
                            oneWayDropOffChargesCurrency(
                                JsonField.ofNullable(oneWayDropOffChargesCurrency)
                            )

                        /**
                         * Alias for calling [Builder.oneWayDropOffChargesCurrency] with
                         * `oneWayDropOffChargesCurrency.orElse(null)`.
                         */
                        fun oneWayDropOffChargesCurrency(
                            oneWayDropOffChargesCurrency: Optional<String>
                        ) = oneWayDropOffChargesCurrency(oneWayDropOffChargesCurrency.getOrNull())

                        /**
                         * Sets [Builder.oneWayDropOffChargesCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.oneWayDropOffChargesCurrency] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun oneWayDropOffChargesCurrency(
                            oneWayDropOffChargesCurrency: JsonField<String>
                        ) = apply {
                            this.oneWayDropOffChargesCurrency = oneWayDropOffChargesCurrency
                        }

                        /** Name of the person renting the vehicle. */
                        fun renterName(renterName: String?) =
                            renterName(JsonField.ofNullable(renterName))

                        /**
                         * Alias for calling [Builder.renterName] with `renterName.orElse(null)`.
                         */
                        fun renterName(renterName: Optional<String>) =
                            renterName(renterName.getOrNull())

                        /**
                         * Sets [Builder.renterName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.renterName] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun renterName(renterName: JsonField<String>) = apply {
                            this.renterName = renterName
                        }

                        /** Weekly rate being charged for the vehicle. */
                        fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long?) =
                            weeklyRentalRateAmount(JsonField.ofNullable(weeklyRentalRateAmount))

                        /**
                         * Alias for [Builder.weeklyRentalRateAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long) =
                            weeklyRentalRateAmount(weeklyRentalRateAmount as Long?)

                        /**
                         * Alias for calling [Builder.weeklyRentalRateAmount] with
                         * `weeklyRentalRateAmount.orElse(null)`.
                         */
                        fun weeklyRentalRateAmount(weeklyRentalRateAmount: Optional<Long>) =
                            weeklyRentalRateAmount(weeklyRentalRateAmount.getOrNull())

                        /**
                         * Sets [Builder.weeklyRentalRateAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.weeklyRentalRateAmount] with a
                         * well-typed [Long] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun weeklyRentalRateAmount(weeklyRentalRateAmount: JsonField<Long>) =
                            apply {
                                this.weeklyRentalRateAmount = weeklyRentalRateAmount
                            }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * weekly rental rate.
                         */
                        fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: String?) =
                            weeklyRentalRateCurrency(JsonField.ofNullable(weeklyRentalRateCurrency))

                        /**
                         * Alias for calling [Builder.weeklyRentalRateCurrency] with
                         * `weeklyRentalRateCurrency.orElse(null)`.
                         */
                        fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: Optional<String>) =
                            weeklyRentalRateCurrency(weeklyRentalRateCurrency.getOrNull())

                        /**
                         * Sets [Builder.weeklyRentalRateCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.weeklyRentalRateCurrency] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: JsonField<String>) =
                            apply {
                                this.weeklyRentalRateCurrency = weeklyRentalRateCurrency
                            }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CarRental].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .carClassCode()
                         * .checkoutDate()
                         * .dailyRentalRateAmount()
                         * .dailyRentalRateCurrency()
                         * .daysRented()
                         * .extraCharges()
                         * .fuelChargesAmount()
                         * .fuelChargesCurrency()
                         * .insuranceChargesAmount()
                         * .insuranceChargesCurrency()
                         * .noShowIndicator()
                         * .oneWayDropOffChargesAmount()
                         * .oneWayDropOffChargesCurrency()
                         * .renterName()
                         * .weeklyRentalRateAmount()
                         * .weeklyRentalRateCurrency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CarRental =
                            CarRental(
                                checkRequired("carClassCode", carClassCode),
                                checkRequired("checkoutDate", checkoutDate),
                                checkRequired("dailyRentalRateAmount", dailyRentalRateAmount),
                                checkRequired("dailyRentalRateCurrency", dailyRentalRateCurrency),
                                checkRequired("daysRented", daysRented),
                                checkRequired("extraCharges", extraCharges),
                                checkRequired("fuelChargesAmount", fuelChargesAmount),
                                checkRequired("fuelChargesCurrency", fuelChargesCurrency),
                                checkRequired("insuranceChargesAmount", insuranceChargesAmount),
                                checkRequired("insuranceChargesCurrency", insuranceChargesCurrency),
                                checkRequired("noShowIndicator", noShowIndicator),
                                checkRequired(
                                    "oneWayDropOffChargesAmount",
                                    oneWayDropOffChargesAmount,
                                ),
                                checkRequired(
                                    "oneWayDropOffChargesCurrency",
                                    oneWayDropOffChargesCurrency,
                                ),
                                checkRequired("renterName", renterName),
                                checkRequired("weeklyRentalRateAmount", weeklyRentalRateAmount),
                                checkRequired("weeklyRentalRateCurrency", weeklyRentalRateCurrency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CarRental = apply {
                        if (validated) {
                            return@apply
                        }

                        carClassCode()
                        checkoutDate()
                        dailyRentalRateAmount()
                        dailyRentalRateCurrency()
                        daysRented()
                        extraCharges().ifPresent { it.validate() }
                        fuelChargesAmount()
                        fuelChargesCurrency()
                        insuranceChargesAmount()
                        insuranceChargesCurrency()
                        noShowIndicator().ifPresent { it.validate() }
                        oneWayDropOffChargesAmount()
                        oneWayDropOffChargesCurrency()
                        renterName()
                        weeklyRentalRateAmount()
                        weeklyRentalRateCurrency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (carClassCode.asKnown().isPresent) 1 else 0) +
                            (if (checkoutDate.asKnown().isPresent) 1 else 0) +
                            (if (dailyRentalRateAmount.asKnown().isPresent) 1 else 0) +
                            (if (dailyRentalRateCurrency.asKnown().isPresent) 1 else 0) +
                            (if (daysRented.asKnown().isPresent) 1 else 0) +
                            (extraCharges.asKnown().getOrNull()?.validity() ?: 0) +
                            (if (fuelChargesAmount.asKnown().isPresent) 1 else 0) +
                            (if (fuelChargesCurrency.asKnown().isPresent) 1 else 0) +
                            (if (insuranceChargesAmount.asKnown().isPresent) 1 else 0) +
                            (if (insuranceChargesCurrency.asKnown().isPresent) 1 else 0) +
                            (noShowIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                            (if (oneWayDropOffChargesAmount.asKnown().isPresent) 1 else 0) +
                            (if (oneWayDropOffChargesCurrency.asKnown().isPresent) 1 else 0) +
                            (if (renterName.asKnown().isPresent) 1 else 0) +
                            (if (weeklyRentalRateAmount.asKnown().isPresent) 1 else 0) +
                            (if (weeklyRentalRateCurrency.asKnown().isPresent) 1 else 0)

                    /** Additional charges (gas, late fee, etc.) being billed. */
                    class ExtraCharges
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** No extra charge */
                            @JvmField val NO_EXTRA_CHARGE = of("no_extra_charge")

                            /** Gas */
                            @JvmField val GAS = of("gas")

                            /** Extra mileage */
                            @JvmField val EXTRA_MILEAGE = of("extra_mileage")

                            /** Late return */
                            @JvmField val LATE_RETURN = of("late_return")

                            /** One way service fee */
                            @JvmField val ONE_WAY_SERVICE_FEE = of("one_way_service_fee")

                            /** Parking violation */
                            @JvmField val PARKING_VIOLATION = of("parking_violation")

                            @JvmStatic fun of(value: String) = ExtraCharges(JsonField.of(value))
                        }

                        /** An enum containing [ExtraCharges]'s known values. */
                        enum class Known {
                            /** No extra charge */
                            NO_EXTRA_CHARGE,
                            /** Gas */
                            GAS,
                            /** Extra mileage */
                            EXTRA_MILEAGE,
                            /** Late return */
                            LATE_RETURN,
                            /** One way service fee */
                            ONE_WAY_SERVICE_FEE,
                            /** Parking violation */
                            PARKING_VIOLATION,
                        }

                        /**
                         * An enum containing [ExtraCharges]'s known values, as well as an
                         * [_UNKNOWN] member.
                         *
                         * An instance of [ExtraCharges] can contain an unknown value in a couple of
                         * cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** No extra charge */
                            NO_EXTRA_CHARGE,
                            /** Gas */
                            GAS,
                            /** Extra mileage */
                            EXTRA_MILEAGE,
                            /** Late return */
                            LATE_RETURN,
                            /** One way service fee */
                            ONE_WAY_SERVICE_FEE,
                            /** Parking violation */
                            PARKING_VIOLATION,
                            /**
                             * An enum member indicating that [ExtraCharges] was instantiated with
                             * an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NO_EXTRA_CHARGE -> Value.NO_EXTRA_CHARGE
                                GAS -> Value.GAS
                                EXTRA_MILEAGE -> Value.EXTRA_MILEAGE
                                LATE_RETURN -> Value.LATE_RETURN
                                ONE_WAY_SERVICE_FEE -> Value.ONE_WAY_SERVICE_FEE
                                PARKING_VIOLATION -> Value.PARKING_VIOLATION
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NO_EXTRA_CHARGE -> Known.NO_EXTRA_CHARGE
                                GAS -> Known.GAS
                                EXTRA_MILEAGE -> Known.EXTRA_MILEAGE
                                LATE_RETURN -> Known.LATE_RETURN
                                ONE_WAY_SERVICE_FEE -> Known.ONE_WAY_SERVICE_FEE
                                PARKING_VIOLATION -> Known.PARKING_VIOLATION
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown ExtraCharges: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): ExtraCharges = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is ExtraCharges && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * An indicator that the cardholder is being billed for a reserved vehicle that
                     * was not actually rented (that is, a "no-show" charge).
                     */
                    class NoShowIndicator
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Not applicable */
                            @JvmField val NOT_APPLICABLE = of("not_applicable")

                            /** No show for specialized vehicle */
                            @JvmField
                            val NO_SHOW_FOR_SPECIALIZED_VEHICLE =
                                of("no_show_for_specialized_vehicle")

                            @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(value))
                        }

                        /** An enum containing [NoShowIndicator]'s known values. */
                        enum class Known {
                            /** Not applicable */
                            NOT_APPLICABLE,
                            /** No show for specialized vehicle */
                            NO_SHOW_FOR_SPECIALIZED_VEHICLE,
                        }

                        /**
                         * An enum containing [NoShowIndicator]'s known values, as well as an
                         * [_UNKNOWN] member.
                         *
                         * An instance of [NoShowIndicator] can contain an unknown value in a couple
                         * of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Not applicable */
                            NOT_APPLICABLE,
                            /** No show for specialized vehicle */
                            NO_SHOW_FOR_SPECIALIZED_VEHICLE,
                            /**
                             * An enum member indicating that [NoShowIndicator] was instantiated
                             * with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NOT_APPLICABLE -> Value.NOT_APPLICABLE
                                NO_SHOW_FOR_SPECIALIZED_VEHICLE ->
                                    Value.NO_SHOW_FOR_SPECIALIZED_VEHICLE
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NOT_APPLICABLE -> Known.NOT_APPLICABLE
                                NO_SHOW_FOR_SPECIALIZED_VEHICLE ->
                                    Known.NO_SHOW_FOR_SPECIALIZED_VEHICLE
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown NoShowIndicator: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): NoShowIndicator = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is NoShowIndicator && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CarRental &&
                            carClassCode == other.carClassCode &&
                            checkoutDate == other.checkoutDate &&
                            dailyRentalRateAmount == other.dailyRentalRateAmount &&
                            dailyRentalRateCurrency == other.dailyRentalRateCurrency &&
                            daysRented == other.daysRented &&
                            extraCharges == other.extraCharges &&
                            fuelChargesAmount == other.fuelChargesAmount &&
                            fuelChargesCurrency == other.fuelChargesCurrency &&
                            insuranceChargesAmount == other.insuranceChargesAmount &&
                            insuranceChargesCurrency == other.insuranceChargesCurrency &&
                            noShowIndicator == other.noShowIndicator &&
                            oneWayDropOffChargesAmount == other.oneWayDropOffChargesAmount &&
                            oneWayDropOffChargesCurrency == other.oneWayDropOffChargesCurrency &&
                            renterName == other.renterName &&
                            weeklyRentalRateAmount == other.weeklyRentalRateAmount &&
                            weeklyRentalRateCurrency == other.weeklyRentalRateCurrency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            carClassCode,
                            checkoutDate,
                            dailyRentalRateAmount,
                            dailyRentalRateCurrency,
                            daysRented,
                            extraCharges,
                            fuelChargesAmount,
                            fuelChargesCurrency,
                            insuranceChargesAmount,
                            insuranceChargesCurrency,
                            noShowIndicator,
                            oneWayDropOffChargesAmount,
                            oneWayDropOffChargesCurrency,
                            renterName,
                            weeklyRentalRateAmount,
                            weeklyRentalRateCurrency,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CarRental{carClassCode=$carClassCode, checkoutDate=$checkoutDate, dailyRentalRateAmount=$dailyRentalRateAmount, dailyRentalRateCurrency=$dailyRentalRateCurrency, daysRented=$daysRented, extraCharges=$extraCharges, fuelChargesAmount=$fuelChargesAmount, fuelChargesCurrency=$fuelChargesCurrency, insuranceChargesAmount=$insuranceChargesAmount, insuranceChargesCurrency=$insuranceChargesCurrency, noShowIndicator=$noShowIndicator, oneWayDropOffChargesAmount=$oneWayDropOffChargesAmount, oneWayDropOffChargesCurrency=$oneWayDropOffChargesCurrency, renterName=$renterName, weeklyRentalRateAmount=$weeklyRentalRateAmount, weeklyRentalRateCurrency=$weeklyRentalRateCurrency, additionalProperties=$additionalProperties}"
                }

                /** Fields specific to lodging. */
                class Lodging
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val checkInDate: JsonField<LocalDate>,
                    private val dailyRoomRateAmount: JsonField<Long>,
                    private val dailyRoomRateCurrency: JsonField<String>,
                    private val extraCharges: JsonField<ExtraCharges>,
                    private val folioCashAdvancesAmount: JsonField<Long>,
                    private val folioCashAdvancesCurrency: JsonField<String>,
                    private val foodBeverageChargesAmount: JsonField<Long>,
                    private val foodBeverageChargesCurrency: JsonField<String>,
                    private val noShowIndicator: JsonField<NoShowIndicator>,
                    private val prepaidExpensesAmount: JsonField<Long>,
                    private val prepaidExpensesCurrency: JsonField<String>,
                    private val roomNights: JsonField<Long>,
                    private val totalRoomTaxAmount: JsonField<Long>,
                    private val totalRoomTaxCurrency: JsonField<String>,
                    private val totalTaxAmount: JsonField<Long>,
                    private val totalTaxCurrency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("check_in_date")
                        @ExcludeMissing
                        checkInDate: JsonField<LocalDate> = JsonMissing.of(),
                        @JsonProperty("daily_room_rate_amount")
                        @ExcludeMissing
                        dailyRoomRateAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("daily_room_rate_currency")
                        @ExcludeMissing
                        dailyRoomRateCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("extra_charges")
                        @ExcludeMissing
                        extraCharges: JsonField<ExtraCharges> = JsonMissing.of(),
                        @JsonProperty("folio_cash_advances_amount")
                        @ExcludeMissing
                        folioCashAdvancesAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("folio_cash_advances_currency")
                        @ExcludeMissing
                        folioCashAdvancesCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("food_beverage_charges_amount")
                        @ExcludeMissing
                        foodBeverageChargesAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("food_beverage_charges_currency")
                        @ExcludeMissing
                        foodBeverageChargesCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("no_show_indicator")
                        @ExcludeMissing
                        noShowIndicator: JsonField<NoShowIndicator> = JsonMissing.of(),
                        @JsonProperty("prepaid_expenses_amount")
                        @ExcludeMissing
                        prepaidExpensesAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("prepaid_expenses_currency")
                        @ExcludeMissing
                        prepaidExpensesCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("room_nights")
                        @ExcludeMissing
                        roomNights: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("total_room_tax_amount")
                        @ExcludeMissing
                        totalRoomTaxAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("total_room_tax_currency")
                        @ExcludeMissing
                        totalRoomTaxCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("total_tax_amount")
                        @ExcludeMissing
                        totalTaxAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("total_tax_currency")
                        @ExcludeMissing
                        totalTaxCurrency: JsonField<String> = JsonMissing.of(),
                    ) : this(
                        checkInDate,
                        dailyRoomRateAmount,
                        dailyRoomRateCurrency,
                        extraCharges,
                        folioCashAdvancesAmount,
                        folioCashAdvancesCurrency,
                        foodBeverageChargesAmount,
                        foodBeverageChargesCurrency,
                        noShowIndicator,
                        prepaidExpensesAmount,
                        prepaidExpensesCurrency,
                        roomNights,
                        totalRoomTaxAmount,
                        totalRoomTaxCurrency,
                        totalTaxAmount,
                        totalTaxCurrency,
                        mutableMapOf(),
                    )

                    /**
                     * Date the customer checked in.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun checkInDate(): Optional<LocalDate> =
                        checkInDate.getOptional("check_in_date")

                    /**
                     * Daily rate being charged for the room.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun dailyRoomRateAmount(): Optional<Long> =
                        dailyRoomRateAmount.getOptional("daily_room_rate_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily
                     * room rate.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun dailyRoomRateCurrency(): Optional<String> =
                        dailyRoomRateCurrency.getOptional("daily_room_rate_currency")

                    /**
                     * Additional charges (phone, late check-out, etc.) being billed.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun extraCharges(): Optional<ExtraCharges> =
                        extraCharges.getOptional("extra_charges")

                    /**
                     * Folio cash advances for the room.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun folioCashAdvancesAmount(): Optional<Long> =
                        folioCashAdvancesAmount.getOptional("folio_cash_advances_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio
                     * cash advances.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun folioCashAdvancesCurrency(): Optional<String> =
                        folioCashAdvancesCurrency.getOptional("folio_cash_advances_currency")

                    /**
                     * Food and beverage charges for the room.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun foodBeverageChargesAmount(): Optional<Long> =
                        foodBeverageChargesAmount.getOptional("food_beverage_charges_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the food and
                     * beverage charges.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun foodBeverageChargesCurrency(): Optional<String> =
                        foodBeverageChargesCurrency.getOptional("food_beverage_charges_currency")

                    /**
                     * Indicator that the cardholder is being billed for a reserved room that was
                     * not actually used.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun noShowIndicator(): Optional<NoShowIndicator> =
                        noShowIndicator.getOptional("no_show_indicator")

                    /**
                     * Prepaid expenses being charged for the room.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun prepaidExpensesAmount(): Optional<Long> =
                        prepaidExpensesAmount.getOptional("prepaid_expenses_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the prepaid
                     * expenses.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun prepaidExpensesCurrency(): Optional<String> =
                        prepaidExpensesCurrency.getOptional("prepaid_expenses_currency")

                    /**
                     * Number of nights the room was rented.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun roomNights(): Optional<Long> = roomNights.getOptional("room_nights")

                    /**
                     * Total room tax being charged.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun totalRoomTaxAmount(): Optional<Long> =
                        totalRoomTaxAmount.getOptional("total_room_tax_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total
                     * room tax.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun totalRoomTaxCurrency(): Optional<String> =
                        totalRoomTaxCurrency.getOptional("total_room_tax_currency")

                    /**
                     * Total tax being charged for the room.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun totalTaxAmount(): Optional<Long> =
                        totalTaxAmount.getOptional("total_tax_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total tax
                     * assessed.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun totalTaxCurrency(): Optional<String> =
                        totalTaxCurrency.getOptional("total_tax_currency")

                    /**
                     * Returns the raw JSON value of [checkInDate].
                     *
                     * Unlike [checkInDate], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("check_in_date")
                    @ExcludeMissing
                    fun _checkInDate(): JsonField<LocalDate> = checkInDate

                    /**
                     * Returns the raw JSON value of [dailyRoomRateAmount].
                     *
                     * Unlike [dailyRoomRateAmount], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("daily_room_rate_amount")
                    @ExcludeMissing
                    fun _dailyRoomRateAmount(): JsonField<Long> = dailyRoomRateAmount

                    /**
                     * Returns the raw JSON value of [dailyRoomRateCurrency].
                     *
                     * Unlike [dailyRoomRateCurrency], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("daily_room_rate_currency")
                    @ExcludeMissing
                    fun _dailyRoomRateCurrency(): JsonField<String> = dailyRoomRateCurrency

                    /**
                     * Returns the raw JSON value of [extraCharges].
                     *
                     * Unlike [extraCharges], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("extra_charges")
                    @ExcludeMissing
                    fun _extraCharges(): JsonField<ExtraCharges> = extraCharges

                    /**
                     * Returns the raw JSON value of [folioCashAdvancesAmount].
                     *
                     * Unlike [folioCashAdvancesAmount], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("folio_cash_advances_amount")
                    @ExcludeMissing
                    fun _folioCashAdvancesAmount(): JsonField<Long> = folioCashAdvancesAmount

                    /**
                     * Returns the raw JSON value of [folioCashAdvancesCurrency].
                     *
                     * Unlike [folioCashAdvancesCurrency], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("folio_cash_advances_currency")
                    @ExcludeMissing
                    fun _folioCashAdvancesCurrency(): JsonField<String> = folioCashAdvancesCurrency

                    /**
                     * Returns the raw JSON value of [foodBeverageChargesAmount].
                     *
                     * Unlike [foodBeverageChargesAmount], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("food_beverage_charges_amount")
                    @ExcludeMissing
                    fun _foodBeverageChargesAmount(): JsonField<Long> = foodBeverageChargesAmount

                    /**
                     * Returns the raw JSON value of [foodBeverageChargesCurrency].
                     *
                     * Unlike [foodBeverageChargesCurrency], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("food_beverage_charges_currency")
                    @ExcludeMissing
                    fun _foodBeverageChargesCurrency(): JsonField<String> =
                        foodBeverageChargesCurrency

                    /**
                     * Returns the raw JSON value of [noShowIndicator].
                     *
                     * Unlike [noShowIndicator], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("no_show_indicator")
                    @ExcludeMissing
                    fun _noShowIndicator(): JsonField<NoShowIndicator> = noShowIndicator

                    /**
                     * Returns the raw JSON value of [prepaidExpensesAmount].
                     *
                     * Unlike [prepaidExpensesAmount], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("prepaid_expenses_amount")
                    @ExcludeMissing
                    fun _prepaidExpensesAmount(): JsonField<Long> = prepaidExpensesAmount

                    /**
                     * Returns the raw JSON value of [prepaidExpensesCurrency].
                     *
                     * Unlike [prepaidExpensesCurrency], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("prepaid_expenses_currency")
                    @ExcludeMissing
                    fun _prepaidExpensesCurrency(): JsonField<String> = prepaidExpensesCurrency

                    /**
                     * Returns the raw JSON value of [roomNights].
                     *
                     * Unlike [roomNights], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("room_nights")
                    @ExcludeMissing
                    fun _roomNights(): JsonField<Long> = roomNights

                    /**
                     * Returns the raw JSON value of [totalRoomTaxAmount].
                     *
                     * Unlike [totalRoomTaxAmount], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("total_room_tax_amount")
                    @ExcludeMissing
                    fun _totalRoomTaxAmount(): JsonField<Long> = totalRoomTaxAmount

                    /**
                     * Returns the raw JSON value of [totalRoomTaxCurrency].
                     *
                     * Unlike [totalRoomTaxCurrency], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("total_room_tax_currency")
                    @ExcludeMissing
                    fun _totalRoomTaxCurrency(): JsonField<String> = totalRoomTaxCurrency

                    /**
                     * Returns the raw JSON value of [totalTaxAmount].
                     *
                     * Unlike [totalTaxAmount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("total_tax_amount")
                    @ExcludeMissing
                    fun _totalTaxAmount(): JsonField<Long> = totalTaxAmount

                    /**
                     * Returns the raw JSON value of [totalTaxCurrency].
                     *
                     * Unlike [totalTaxCurrency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("total_tax_currency")
                    @ExcludeMissing
                    fun _totalTaxCurrency(): JsonField<String> = totalTaxCurrency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Lodging].
                         *
                         * The following fields are required:
                         * ```java
                         * .checkInDate()
                         * .dailyRoomRateAmount()
                         * .dailyRoomRateCurrency()
                         * .extraCharges()
                         * .folioCashAdvancesAmount()
                         * .folioCashAdvancesCurrency()
                         * .foodBeverageChargesAmount()
                         * .foodBeverageChargesCurrency()
                         * .noShowIndicator()
                         * .prepaidExpensesAmount()
                         * .prepaidExpensesCurrency()
                         * .roomNights()
                         * .totalRoomTaxAmount()
                         * .totalRoomTaxCurrency()
                         * .totalTaxAmount()
                         * .totalTaxCurrency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Lodging]. */
                    class Builder internal constructor() {

                        private var checkInDate: JsonField<LocalDate>? = null
                        private var dailyRoomRateAmount: JsonField<Long>? = null
                        private var dailyRoomRateCurrency: JsonField<String>? = null
                        private var extraCharges: JsonField<ExtraCharges>? = null
                        private var folioCashAdvancesAmount: JsonField<Long>? = null
                        private var folioCashAdvancesCurrency: JsonField<String>? = null
                        private var foodBeverageChargesAmount: JsonField<Long>? = null
                        private var foodBeverageChargesCurrency: JsonField<String>? = null
                        private var noShowIndicator: JsonField<NoShowIndicator>? = null
                        private var prepaidExpensesAmount: JsonField<Long>? = null
                        private var prepaidExpensesCurrency: JsonField<String>? = null
                        private var roomNights: JsonField<Long>? = null
                        private var totalRoomTaxAmount: JsonField<Long>? = null
                        private var totalRoomTaxCurrency: JsonField<String>? = null
                        private var totalTaxAmount: JsonField<Long>? = null
                        private var totalTaxCurrency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(lodging: Lodging) = apply {
                            checkInDate = lodging.checkInDate
                            dailyRoomRateAmount = lodging.dailyRoomRateAmount
                            dailyRoomRateCurrency = lodging.dailyRoomRateCurrency
                            extraCharges = lodging.extraCharges
                            folioCashAdvancesAmount = lodging.folioCashAdvancesAmount
                            folioCashAdvancesCurrency = lodging.folioCashAdvancesCurrency
                            foodBeverageChargesAmount = lodging.foodBeverageChargesAmount
                            foodBeverageChargesCurrency = lodging.foodBeverageChargesCurrency
                            noShowIndicator = lodging.noShowIndicator
                            prepaidExpensesAmount = lodging.prepaidExpensesAmount
                            prepaidExpensesCurrency = lodging.prepaidExpensesCurrency
                            roomNights = lodging.roomNights
                            totalRoomTaxAmount = lodging.totalRoomTaxAmount
                            totalRoomTaxCurrency = lodging.totalRoomTaxCurrency
                            totalTaxAmount = lodging.totalTaxAmount
                            totalTaxCurrency = lodging.totalTaxCurrency
                            additionalProperties = lodging.additionalProperties.toMutableMap()
                        }

                        /** Date the customer checked in. */
                        fun checkInDate(checkInDate: LocalDate?) =
                            checkInDate(JsonField.ofNullable(checkInDate))

                        /**
                         * Alias for calling [Builder.checkInDate] with `checkInDate.orElse(null)`.
                         */
                        fun checkInDate(checkInDate: Optional<LocalDate>) =
                            checkInDate(checkInDate.getOrNull())

                        /**
                         * Sets [Builder.checkInDate] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.checkInDate] with a well-typed
                         * [LocalDate] value instead. This method is primarily for setting the field
                         * to an undocumented or not yet supported value.
                         */
                        fun checkInDate(checkInDate: JsonField<LocalDate>) = apply {
                            this.checkInDate = checkInDate
                        }

                        /** Daily rate being charged for the room. */
                        fun dailyRoomRateAmount(dailyRoomRateAmount: Long?) =
                            dailyRoomRateAmount(JsonField.ofNullable(dailyRoomRateAmount))

                        /**
                         * Alias for [Builder.dailyRoomRateAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun dailyRoomRateAmount(dailyRoomRateAmount: Long) =
                            dailyRoomRateAmount(dailyRoomRateAmount as Long?)

                        /**
                         * Alias for calling [Builder.dailyRoomRateAmount] with
                         * `dailyRoomRateAmount.orElse(null)`.
                         */
                        fun dailyRoomRateAmount(dailyRoomRateAmount: Optional<Long>) =
                            dailyRoomRateAmount(dailyRoomRateAmount.getOrNull())

                        /**
                         * Sets [Builder.dailyRoomRateAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.dailyRoomRateAmount] with a well-typed
                         * [Long] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun dailyRoomRateAmount(dailyRoomRateAmount: JsonField<Long>) = apply {
                            this.dailyRoomRateAmount = dailyRoomRateAmount
                        }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily
                         * room rate.
                         */
                        fun dailyRoomRateCurrency(dailyRoomRateCurrency: String?) =
                            dailyRoomRateCurrency(JsonField.ofNullable(dailyRoomRateCurrency))

                        /**
                         * Alias for calling [Builder.dailyRoomRateCurrency] with
                         * `dailyRoomRateCurrency.orElse(null)`.
                         */
                        fun dailyRoomRateCurrency(dailyRoomRateCurrency: Optional<String>) =
                            dailyRoomRateCurrency(dailyRoomRateCurrency.getOrNull())

                        /**
                         * Sets [Builder.dailyRoomRateCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.dailyRoomRateCurrency] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun dailyRoomRateCurrency(dailyRoomRateCurrency: JsonField<String>) =
                            apply {
                                this.dailyRoomRateCurrency = dailyRoomRateCurrency
                            }

                        /** Additional charges (phone, late check-out, etc.) being billed. */
                        fun extraCharges(extraCharges: ExtraCharges?) =
                            extraCharges(JsonField.ofNullable(extraCharges))

                        /**
                         * Alias for calling [Builder.extraCharges] with
                         * `extraCharges.orElse(null)`.
                         */
                        fun extraCharges(extraCharges: Optional<ExtraCharges>) =
                            extraCharges(extraCharges.getOrNull())

                        /**
                         * Sets [Builder.extraCharges] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.extraCharges] with a well-typed
                         * [ExtraCharges] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun extraCharges(extraCharges: JsonField<ExtraCharges>) = apply {
                            this.extraCharges = extraCharges
                        }

                        /** Folio cash advances for the room. */
                        fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long?) =
                            folioCashAdvancesAmount(JsonField.ofNullable(folioCashAdvancesAmount))

                        /**
                         * Alias for [Builder.folioCashAdvancesAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long) =
                            folioCashAdvancesAmount(folioCashAdvancesAmount as Long?)

                        /**
                         * Alias for calling [Builder.folioCashAdvancesAmount] with
                         * `folioCashAdvancesAmount.orElse(null)`.
                         */
                        fun folioCashAdvancesAmount(folioCashAdvancesAmount: Optional<Long>) =
                            folioCashAdvancesAmount(folioCashAdvancesAmount.getOrNull())

                        /**
                         * Sets [Builder.folioCashAdvancesAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.folioCashAdvancesAmount] with a
                         * well-typed [Long] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun folioCashAdvancesAmount(folioCashAdvancesAmount: JsonField<Long>) =
                            apply {
                                this.folioCashAdvancesAmount = folioCashAdvancesAmount
                            }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio
                         * cash advances.
                         */
                        fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: String?) =
                            folioCashAdvancesCurrency(
                                JsonField.ofNullable(folioCashAdvancesCurrency)
                            )

                        /**
                         * Alias for calling [Builder.folioCashAdvancesCurrency] with
                         * `folioCashAdvancesCurrency.orElse(null)`.
                         */
                        fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: Optional<String>) =
                            folioCashAdvancesCurrency(folioCashAdvancesCurrency.getOrNull())

                        /**
                         * Sets [Builder.folioCashAdvancesCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.folioCashAdvancesCurrency] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun folioCashAdvancesCurrency(
                            folioCashAdvancesCurrency: JsonField<String>
                        ) = apply { this.folioCashAdvancesCurrency = folioCashAdvancesCurrency }

                        /** Food and beverage charges for the room. */
                        fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long?) =
                            foodBeverageChargesAmount(
                                JsonField.ofNullable(foodBeverageChargesAmount)
                            )

                        /**
                         * Alias for [Builder.foodBeverageChargesAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long) =
                            foodBeverageChargesAmount(foodBeverageChargesAmount as Long?)

                        /**
                         * Alias for calling [Builder.foodBeverageChargesAmount] with
                         * `foodBeverageChargesAmount.orElse(null)`.
                         */
                        fun foodBeverageChargesAmount(foodBeverageChargesAmount: Optional<Long>) =
                            foodBeverageChargesAmount(foodBeverageChargesAmount.getOrNull())

                        /**
                         * Sets [Builder.foodBeverageChargesAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.foodBeverageChargesAmount] with a
                         * well-typed [Long] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun foodBeverageChargesAmount(foodBeverageChargesAmount: JsonField<Long>) =
                            apply {
                                this.foodBeverageChargesAmount = foodBeverageChargesAmount
                            }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the food
                         * and beverage charges.
                         */
                        fun foodBeverageChargesCurrency(foodBeverageChargesCurrency: String?) =
                            foodBeverageChargesCurrency(
                                JsonField.ofNullable(foodBeverageChargesCurrency)
                            )

                        /**
                         * Alias for calling [Builder.foodBeverageChargesCurrency] with
                         * `foodBeverageChargesCurrency.orElse(null)`.
                         */
                        fun foodBeverageChargesCurrency(
                            foodBeverageChargesCurrency: Optional<String>
                        ) = foodBeverageChargesCurrency(foodBeverageChargesCurrency.getOrNull())

                        /**
                         * Sets [Builder.foodBeverageChargesCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.foodBeverageChargesCurrency] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun foodBeverageChargesCurrency(
                            foodBeverageChargesCurrency: JsonField<String>
                        ) = apply { this.foodBeverageChargesCurrency = foodBeverageChargesCurrency }

                        /**
                         * Indicator that the cardholder is being billed for a reserved room that
                         * was not actually used.
                         */
                        fun noShowIndicator(noShowIndicator: NoShowIndicator?) =
                            noShowIndicator(JsonField.ofNullable(noShowIndicator))

                        /**
                         * Alias for calling [Builder.noShowIndicator] with
                         * `noShowIndicator.orElse(null)`.
                         */
                        fun noShowIndicator(noShowIndicator: Optional<NoShowIndicator>) =
                            noShowIndicator(noShowIndicator.getOrNull())

                        /**
                         * Sets [Builder.noShowIndicator] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.noShowIndicator] with a well-typed
                         * [NoShowIndicator] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun noShowIndicator(noShowIndicator: JsonField<NoShowIndicator>) = apply {
                            this.noShowIndicator = noShowIndicator
                        }

                        /** Prepaid expenses being charged for the room. */
                        fun prepaidExpensesAmount(prepaidExpensesAmount: Long?) =
                            prepaidExpensesAmount(JsonField.ofNullable(prepaidExpensesAmount))

                        /**
                         * Alias for [Builder.prepaidExpensesAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun prepaidExpensesAmount(prepaidExpensesAmount: Long) =
                            prepaidExpensesAmount(prepaidExpensesAmount as Long?)

                        /**
                         * Alias for calling [Builder.prepaidExpensesAmount] with
                         * `prepaidExpensesAmount.orElse(null)`.
                         */
                        fun prepaidExpensesAmount(prepaidExpensesAmount: Optional<Long>) =
                            prepaidExpensesAmount(prepaidExpensesAmount.getOrNull())

                        /**
                         * Sets [Builder.prepaidExpensesAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.prepaidExpensesAmount] with a well-typed
                         * [Long] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun prepaidExpensesAmount(prepaidExpensesAmount: JsonField<Long>) = apply {
                            this.prepaidExpensesAmount = prepaidExpensesAmount
                        }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * prepaid expenses.
                         */
                        fun prepaidExpensesCurrency(prepaidExpensesCurrency: String?) =
                            prepaidExpensesCurrency(JsonField.ofNullable(prepaidExpensesCurrency))

                        /**
                         * Alias for calling [Builder.prepaidExpensesCurrency] with
                         * `prepaidExpensesCurrency.orElse(null)`.
                         */
                        fun prepaidExpensesCurrency(prepaidExpensesCurrency: Optional<String>) =
                            prepaidExpensesCurrency(prepaidExpensesCurrency.getOrNull())

                        /**
                         * Sets [Builder.prepaidExpensesCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.prepaidExpensesCurrency] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun prepaidExpensesCurrency(prepaidExpensesCurrency: JsonField<String>) =
                            apply {
                                this.prepaidExpensesCurrency = prepaidExpensesCurrency
                            }

                        /** Number of nights the room was rented. */
                        fun roomNights(roomNights: Long?) =
                            roomNights(JsonField.ofNullable(roomNights))

                        /**
                         * Alias for [Builder.roomNights].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun roomNights(roomNights: Long) = roomNights(roomNights as Long?)

                        /**
                         * Alias for calling [Builder.roomNights] with `roomNights.orElse(null)`.
                         */
                        fun roomNights(roomNights: Optional<Long>) =
                            roomNights(roomNights.getOrNull())

                        /**
                         * Sets [Builder.roomNights] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.roomNights] with a well-typed [Long]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun roomNights(roomNights: JsonField<Long>) = apply {
                            this.roomNights = roomNights
                        }

                        /** Total room tax being charged. */
                        fun totalRoomTaxAmount(totalRoomTaxAmount: Long?) =
                            totalRoomTaxAmount(JsonField.ofNullable(totalRoomTaxAmount))

                        /**
                         * Alias for [Builder.totalRoomTaxAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun totalRoomTaxAmount(totalRoomTaxAmount: Long) =
                            totalRoomTaxAmount(totalRoomTaxAmount as Long?)

                        /**
                         * Alias for calling [Builder.totalRoomTaxAmount] with
                         * `totalRoomTaxAmount.orElse(null)`.
                         */
                        fun totalRoomTaxAmount(totalRoomTaxAmount: Optional<Long>) =
                            totalRoomTaxAmount(totalRoomTaxAmount.getOrNull())

                        /**
                         * Sets [Builder.totalRoomTaxAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.totalRoomTaxAmount] with a well-typed
                         * [Long] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun totalRoomTaxAmount(totalRoomTaxAmount: JsonField<Long>) = apply {
                            this.totalRoomTaxAmount = totalRoomTaxAmount
                        }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total
                         * room tax.
                         */
                        fun totalRoomTaxCurrency(totalRoomTaxCurrency: String?) =
                            totalRoomTaxCurrency(JsonField.ofNullable(totalRoomTaxCurrency))

                        /**
                         * Alias for calling [Builder.totalRoomTaxCurrency] with
                         * `totalRoomTaxCurrency.orElse(null)`.
                         */
                        fun totalRoomTaxCurrency(totalRoomTaxCurrency: Optional<String>) =
                            totalRoomTaxCurrency(totalRoomTaxCurrency.getOrNull())

                        /**
                         * Sets [Builder.totalRoomTaxCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.totalRoomTaxCurrency] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun totalRoomTaxCurrency(totalRoomTaxCurrency: JsonField<String>) = apply {
                            this.totalRoomTaxCurrency = totalRoomTaxCurrency
                        }

                        /** Total tax being charged for the room. */
                        fun totalTaxAmount(totalTaxAmount: Long?) =
                            totalTaxAmount(JsonField.ofNullable(totalTaxAmount))

                        /**
                         * Alias for [Builder.totalTaxAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun totalTaxAmount(totalTaxAmount: Long) =
                            totalTaxAmount(totalTaxAmount as Long?)

                        /**
                         * Alias for calling [Builder.totalTaxAmount] with
                         * `totalTaxAmount.orElse(null)`.
                         */
                        fun totalTaxAmount(totalTaxAmount: Optional<Long>) =
                            totalTaxAmount(totalTaxAmount.getOrNull())

                        /**
                         * Sets [Builder.totalTaxAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.totalTaxAmount] with a well-typed [Long]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun totalTaxAmount(totalTaxAmount: JsonField<Long>) = apply {
                            this.totalTaxAmount = totalTaxAmount
                        }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total
                         * tax assessed.
                         */
                        fun totalTaxCurrency(totalTaxCurrency: String?) =
                            totalTaxCurrency(JsonField.ofNullable(totalTaxCurrency))

                        /**
                         * Alias for calling [Builder.totalTaxCurrency] with
                         * `totalTaxCurrency.orElse(null)`.
                         */
                        fun totalTaxCurrency(totalTaxCurrency: Optional<String>) =
                            totalTaxCurrency(totalTaxCurrency.getOrNull())

                        /**
                         * Sets [Builder.totalTaxCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.totalTaxCurrency] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun totalTaxCurrency(totalTaxCurrency: JsonField<String>) = apply {
                            this.totalTaxCurrency = totalTaxCurrency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Lodging].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .checkInDate()
                         * .dailyRoomRateAmount()
                         * .dailyRoomRateCurrency()
                         * .extraCharges()
                         * .folioCashAdvancesAmount()
                         * .folioCashAdvancesCurrency()
                         * .foodBeverageChargesAmount()
                         * .foodBeverageChargesCurrency()
                         * .noShowIndicator()
                         * .prepaidExpensesAmount()
                         * .prepaidExpensesCurrency()
                         * .roomNights()
                         * .totalRoomTaxAmount()
                         * .totalRoomTaxCurrency()
                         * .totalTaxAmount()
                         * .totalTaxCurrency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Lodging =
                            Lodging(
                                checkRequired("checkInDate", checkInDate),
                                checkRequired("dailyRoomRateAmount", dailyRoomRateAmount),
                                checkRequired("dailyRoomRateCurrency", dailyRoomRateCurrency),
                                checkRequired("extraCharges", extraCharges),
                                checkRequired("folioCashAdvancesAmount", folioCashAdvancesAmount),
                                checkRequired(
                                    "folioCashAdvancesCurrency",
                                    folioCashAdvancesCurrency,
                                ),
                                checkRequired(
                                    "foodBeverageChargesAmount",
                                    foodBeverageChargesAmount,
                                ),
                                checkRequired(
                                    "foodBeverageChargesCurrency",
                                    foodBeverageChargesCurrency,
                                ),
                                checkRequired("noShowIndicator", noShowIndicator),
                                checkRequired("prepaidExpensesAmount", prepaidExpensesAmount),
                                checkRequired("prepaidExpensesCurrency", prepaidExpensesCurrency),
                                checkRequired("roomNights", roomNights),
                                checkRequired("totalRoomTaxAmount", totalRoomTaxAmount),
                                checkRequired("totalRoomTaxCurrency", totalRoomTaxCurrency),
                                checkRequired("totalTaxAmount", totalTaxAmount),
                                checkRequired("totalTaxCurrency", totalTaxCurrency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Lodging = apply {
                        if (validated) {
                            return@apply
                        }

                        checkInDate()
                        dailyRoomRateAmount()
                        dailyRoomRateCurrency()
                        extraCharges().ifPresent { it.validate() }
                        folioCashAdvancesAmount()
                        folioCashAdvancesCurrency()
                        foodBeverageChargesAmount()
                        foodBeverageChargesCurrency()
                        noShowIndicator().ifPresent { it.validate() }
                        prepaidExpensesAmount()
                        prepaidExpensesCurrency()
                        roomNights()
                        totalRoomTaxAmount()
                        totalRoomTaxCurrency()
                        totalTaxAmount()
                        totalTaxCurrency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (checkInDate.asKnown().isPresent) 1 else 0) +
                            (if (dailyRoomRateAmount.asKnown().isPresent) 1 else 0) +
                            (if (dailyRoomRateCurrency.asKnown().isPresent) 1 else 0) +
                            (extraCharges.asKnown().getOrNull()?.validity() ?: 0) +
                            (if (folioCashAdvancesAmount.asKnown().isPresent) 1 else 0) +
                            (if (folioCashAdvancesCurrency.asKnown().isPresent) 1 else 0) +
                            (if (foodBeverageChargesAmount.asKnown().isPresent) 1 else 0) +
                            (if (foodBeverageChargesCurrency.asKnown().isPresent) 1 else 0) +
                            (noShowIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                            (if (prepaidExpensesAmount.asKnown().isPresent) 1 else 0) +
                            (if (prepaidExpensesCurrency.asKnown().isPresent) 1 else 0) +
                            (if (roomNights.asKnown().isPresent) 1 else 0) +
                            (if (totalRoomTaxAmount.asKnown().isPresent) 1 else 0) +
                            (if (totalRoomTaxCurrency.asKnown().isPresent) 1 else 0) +
                            (if (totalTaxAmount.asKnown().isPresent) 1 else 0) +
                            (if (totalTaxCurrency.asKnown().isPresent) 1 else 0)

                    /** Additional charges (phone, late check-out, etc.) being billed. */
                    class ExtraCharges
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** No extra charge */
                            @JvmField val NO_EXTRA_CHARGE = of("no_extra_charge")

                            /** Restaurant */
                            @JvmField val RESTAURANT = of("restaurant")

                            /** Gift shop */
                            @JvmField val GIFT_SHOP = of("gift_shop")

                            /** Mini bar */
                            @JvmField val MINI_BAR = of("mini_bar")

                            /** Telephone */
                            @JvmField val TELEPHONE = of("telephone")

                            /** Other */
                            @JvmField val OTHER = of("other")

                            /** Laundry */
                            @JvmField val LAUNDRY = of("laundry")

                            @JvmStatic fun of(value: String) = ExtraCharges(JsonField.of(value))
                        }

                        /** An enum containing [ExtraCharges]'s known values. */
                        enum class Known {
                            /** No extra charge */
                            NO_EXTRA_CHARGE,
                            /** Restaurant */
                            RESTAURANT,
                            /** Gift shop */
                            GIFT_SHOP,
                            /** Mini bar */
                            MINI_BAR,
                            /** Telephone */
                            TELEPHONE,
                            /** Other */
                            OTHER,
                            /** Laundry */
                            LAUNDRY,
                        }

                        /**
                         * An enum containing [ExtraCharges]'s known values, as well as an
                         * [_UNKNOWN] member.
                         *
                         * An instance of [ExtraCharges] can contain an unknown value in a couple of
                         * cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** No extra charge */
                            NO_EXTRA_CHARGE,
                            /** Restaurant */
                            RESTAURANT,
                            /** Gift shop */
                            GIFT_SHOP,
                            /** Mini bar */
                            MINI_BAR,
                            /** Telephone */
                            TELEPHONE,
                            /** Other */
                            OTHER,
                            /** Laundry */
                            LAUNDRY,
                            /**
                             * An enum member indicating that [ExtraCharges] was instantiated with
                             * an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NO_EXTRA_CHARGE -> Value.NO_EXTRA_CHARGE
                                RESTAURANT -> Value.RESTAURANT
                                GIFT_SHOP -> Value.GIFT_SHOP
                                MINI_BAR -> Value.MINI_BAR
                                TELEPHONE -> Value.TELEPHONE
                                OTHER -> Value.OTHER
                                LAUNDRY -> Value.LAUNDRY
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NO_EXTRA_CHARGE -> Known.NO_EXTRA_CHARGE
                                RESTAURANT -> Known.RESTAURANT
                                GIFT_SHOP -> Known.GIFT_SHOP
                                MINI_BAR -> Known.MINI_BAR
                                TELEPHONE -> Known.TELEPHONE
                                OTHER -> Known.OTHER
                                LAUNDRY -> Known.LAUNDRY
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown ExtraCharges: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): ExtraCharges = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is ExtraCharges && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * Indicator that the cardholder is being billed for a reserved room that was
                     * not actually used.
                     */
                    class NoShowIndicator
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Not applicable */
                            @JvmField val NOT_APPLICABLE = of("not_applicable")

                            /** No show */
                            @JvmField val NO_SHOW = of("no_show")

                            @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(value))
                        }

                        /** An enum containing [NoShowIndicator]'s known values. */
                        enum class Known {
                            /** Not applicable */
                            NOT_APPLICABLE,
                            /** No show */
                            NO_SHOW,
                        }

                        /**
                         * An enum containing [NoShowIndicator]'s known values, as well as an
                         * [_UNKNOWN] member.
                         *
                         * An instance of [NoShowIndicator] can contain an unknown value in a couple
                         * of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Not applicable */
                            NOT_APPLICABLE,
                            /** No show */
                            NO_SHOW,
                            /**
                             * An enum member indicating that [NoShowIndicator] was instantiated
                             * with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NOT_APPLICABLE -> Value.NOT_APPLICABLE
                                NO_SHOW -> Value.NO_SHOW
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NOT_APPLICABLE -> Known.NOT_APPLICABLE
                                NO_SHOW -> Known.NO_SHOW
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown NoShowIndicator: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): NoShowIndicator = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is NoShowIndicator && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Lodging &&
                            checkInDate == other.checkInDate &&
                            dailyRoomRateAmount == other.dailyRoomRateAmount &&
                            dailyRoomRateCurrency == other.dailyRoomRateCurrency &&
                            extraCharges == other.extraCharges &&
                            folioCashAdvancesAmount == other.folioCashAdvancesAmount &&
                            folioCashAdvancesCurrency == other.folioCashAdvancesCurrency &&
                            foodBeverageChargesAmount == other.foodBeverageChargesAmount &&
                            foodBeverageChargesCurrency == other.foodBeverageChargesCurrency &&
                            noShowIndicator == other.noShowIndicator &&
                            prepaidExpensesAmount == other.prepaidExpensesAmount &&
                            prepaidExpensesCurrency == other.prepaidExpensesCurrency &&
                            roomNights == other.roomNights &&
                            totalRoomTaxAmount == other.totalRoomTaxAmount &&
                            totalRoomTaxCurrency == other.totalRoomTaxCurrency &&
                            totalTaxAmount == other.totalTaxAmount &&
                            totalTaxCurrency == other.totalTaxCurrency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            checkInDate,
                            dailyRoomRateAmount,
                            dailyRoomRateCurrency,
                            extraCharges,
                            folioCashAdvancesAmount,
                            folioCashAdvancesCurrency,
                            foodBeverageChargesAmount,
                            foodBeverageChargesCurrency,
                            noShowIndicator,
                            prepaidExpensesAmount,
                            prepaidExpensesCurrency,
                            roomNights,
                            totalRoomTaxAmount,
                            totalRoomTaxCurrency,
                            totalTaxAmount,
                            totalTaxCurrency,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Lodging{checkInDate=$checkInDate, dailyRoomRateAmount=$dailyRoomRateAmount, dailyRoomRateCurrency=$dailyRoomRateCurrency, extraCharges=$extraCharges, folioCashAdvancesAmount=$folioCashAdvancesAmount, folioCashAdvancesCurrency=$folioCashAdvancesCurrency, foodBeverageChargesAmount=$foodBeverageChargesAmount, foodBeverageChargesCurrency=$foodBeverageChargesCurrency, noShowIndicator=$noShowIndicator, prepaidExpensesAmount=$prepaidExpensesAmount, prepaidExpensesCurrency=$prepaidExpensesCurrency, roomNights=$roomNights, totalRoomTaxAmount=$totalRoomTaxAmount, totalRoomTaxCurrency=$totalRoomTaxCurrency, totalTaxAmount=$totalTaxAmount, totalTaxCurrency=$totalTaxCurrency, additionalProperties=$additionalProperties}"
                }

                /** The format of the purchase identifier. */
                class PurchaseIdentifierFormat
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** Free text */
                        @JvmField val FREE_TEXT = of("free_text")

                        /** Order number */
                        @JvmField val ORDER_NUMBER = of("order_number")

                        /** Rental agreement number */
                        @JvmField val RENTAL_AGREEMENT_NUMBER = of("rental_agreement_number")

                        /** Hotel folio number */
                        @JvmField val HOTEL_FOLIO_NUMBER = of("hotel_folio_number")

                        /** Invoice number */
                        @JvmField val INVOICE_NUMBER = of("invoice_number")

                        @JvmStatic
                        fun of(value: String) = PurchaseIdentifierFormat(JsonField.of(value))
                    }

                    /** An enum containing [PurchaseIdentifierFormat]'s known values. */
                    enum class Known {
                        /** Free text */
                        FREE_TEXT,
                        /** Order number */
                        ORDER_NUMBER,
                        /** Rental agreement number */
                        RENTAL_AGREEMENT_NUMBER,
                        /** Hotel folio number */
                        HOTEL_FOLIO_NUMBER,
                        /** Invoice number */
                        INVOICE_NUMBER,
                    }

                    /**
                     * An enum containing [PurchaseIdentifierFormat]'s known values, as well as an
                     * [_UNKNOWN] member.
                     *
                     * An instance of [PurchaseIdentifierFormat] can contain an unknown value in a
                     * couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** Free text */
                        FREE_TEXT,
                        /** Order number */
                        ORDER_NUMBER,
                        /** Rental agreement number */
                        RENTAL_AGREEMENT_NUMBER,
                        /** Hotel folio number */
                        HOTEL_FOLIO_NUMBER,
                        /** Invoice number */
                        INVOICE_NUMBER,
                        /**
                         * An enum member indicating that [PurchaseIdentifierFormat] was
                         * instantiated with an unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            FREE_TEXT -> Value.FREE_TEXT
                            ORDER_NUMBER -> Value.ORDER_NUMBER
                            RENTAL_AGREEMENT_NUMBER -> Value.RENTAL_AGREEMENT_NUMBER
                            HOTEL_FOLIO_NUMBER -> Value.HOTEL_FOLIO_NUMBER
                            INVOICE_NUMBER -> Value.INVOICE_NUMBER
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            FREE_TEXT -> Known.FREE_TEXT
                            ORDER_NUMBER -> Known.ORDER_NUMBER
                            RENTAL_AGREEMENT_NUMBER -> Known.RENTAL_AGREEMENT_NUMBER
                            HOTEL_FOLIO_NUMBER -> Known.HOTEL_FOLIO_NUMBER
                            INVOICE_NUMBER -> Known.INVOICE_NUMBER
                            else ->
                                throw IncreaseInvalidDataException(
                                    "Unknown PurchaseIdentifierFormat: $value"
                                )
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): PurchaseIdentifierFormat = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is PurchaseIdentifierFormat && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** Fields specific to travel. */
                class Travel
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val ancillary: JsonField<Ancillary>,
                    private val computerizedReservationSystem: JsonField<String>,
                    private val creditReasonIndicator: JsonField<CreditReasonIndicator>,
                    private val departureDate: JsonField<LocalDate>,
                    private val originationCityAirportCode: JsonField<String>,
                    private val passengerName: JsonField<String>,
                    private val restrictedTicketIndicator: JsonField<RestrictedTicketIndicator>,
                    private val ticketChangeIndicator: JsonField<TicketChangeIndicator>,
                    private val ticketNumber: JsonField<String>,
                    private val travelAgencyCode: JsonField<String>,
                    private val travelAgencyName: JsonField<String>,
                    private val tripLegs: JsonField<List<TripLeg>>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("ancillary")
                        @ExcludeMissing
                        ancillary: JsonField<Ancillary> = JsonMissing.of(),
                        @JsonProperty("computerized_reservation_system")
                        @ExcludeMissing
                        computerizedReservationSystem: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("credit_reason_indicator")
                        @ExcludeMissing
                        creditReasonIndicator: JsonField<CreditReasonIndicator> = JsonMissing.of(),
                        @JsonProperty("departure_date")
                        @ExcludeMissing
                        departureDate: JsonField<LocalDate> = JsonMissing.of(),
                        @JsonProperty("origination_city_airport_code")
                        @ExcludeMissing
                        originationCityAirportCode: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("passenger_name")
                        @ExcludeMissing
                        passengerName: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("restricted_ticket_indicator")
                        @ExcludeMissing
                        restrictedTicketIndicator: JsonField<RestrictedTicketIndicator> =
                            JsonMissing.of(),
                        @JsonProperty("ticket_change_indicator")
                        @ExcludeMissing
                        ticketChangeIndicator: JsonField<TicketChangeIndicator> = JsonMissing.of(),
                        @JsonProperty("ticket_number")
                        @ExcludeMissing
                        ticketNumber: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("travel_agency_code")
                        @ExcludeMissing
                        travelAgencyCode: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("travel_agency_name")
                        @ExcludeMissing
                        travelAgencyName: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("trip_legs")
                        @ExcludeMissing
                        tripLegs: JsonField<List<TripLeg>> = JsonMissing.of(),
                    ) : this(
                        ancillary,
                        computerizedReservationSystem,
                        creditReasonIndicator,
                        departureDate,
                        originationCityAirportCode,
                        passengerName,
                        restrictedTicketIndicator,
                        ticketChangeIndicator,
                        ticketNumber,
                        travelAgencyCode,
                        travelAgencyName,
                        tripLegs,
                        mutableMapOf(),
                    )

                    /**
                     * Ancillary purchases in addition to the airfare.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun ancillary(): Optional<Ancillary> = ancillary.getOptional("ancillary")

                    /**
                     * Indicates the computerized reservation system used to book the ticket.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun computerizedReservationSystem(): Optional<String> =
                        computerizedReservationSystem.getOptional("computerized_reservation_system")

                    /**
                     * Indicates the reason for a credit to the cardholder.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun creditReasonIndicator(): Optional<CreditReasonIndicator> =
                        creditReasonIndicator.getOptional("credit_reason_indicator")

                    /**
                     * Date of departure.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun departureDate(): Optional<LocalDate> =
                        departureDate.getOptional("departure_date")

                    /**
                     * Code for the originating city or airport.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun originationCityAirportCode(): Optional<String> =
                        originationCityAirportCode.getOptional("origination_city_airport_code")

                    /**
                     * Name of the passenger.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun passengerName(): Optional<String> =
                        passengerName.getOptional("passenger_name")

                    /**
                     * Indicates whether this ticket is non-refundable.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun restrictedTicketIndicator(): Optional<RestrictedTicketIndicator> =
                        restrictedTicketIndicator.getOptional("restricted_ticket_indicator")

                    /**
                     * Indicates why a ticket was changed.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun ticketChangeIndicator(): Optional<TicketChangeIndicator> =
                        ticketChangeIndicator.getOptional("ticket_change_indicator")

                    /**
                     * Ticket number.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun ticketNumber(): Optional<String> = ticketNumber.getOptional("ticket_number")

                    /**
                     * Code for the travel agency if the ticket was issued by a travel agency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun travelAgencyCode(): Optional<String> =
                        travelAgencyCode.getOptional("travel_agency_code")

                    /**
                     * Name of the travel agency if the ticket was issued by a travel agency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun travelAgencyName(): Optional<String> =
                        travelAgencyName.getOptional("travel_agency_name")

                    /**
                     * Fields specific to each leg of the journey.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun tripLegs(): Optional<List<TripLeg>> = tripLegs.getOptional("trip_legs")

                    /**
                     * Returns the raw JSON value of [ancillary].
                     *
                     * Unlike [ancillary], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("ancillary")
                    @ExcludeMissing
                    fun _ancillary(): JsonField<Ancillary> = ancillary

                    /**
                     * Returns the raw JSON value of [computerizedReservationSystem].
                     *
                     * Unlike [computerizedReservationSystem], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("computerized_reservation_system")
                    @ExcludeMissing
                    fun _computerizedReservationSystem(): JsonField<String> =
                        computerizedReservationSystem

                    /**
                     * Returns the raw JSON value of [creditReasonIndicator].
                     *
                     * Unlike [creditReasonIndicator], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("credit_reason_indicator")
                    @ExcludeMissing
                    fun _creditReasonIndicator(): JsonField<CreditReasonIndicator> =
                        creditReasonIndicator

                    /**
                     * Returns the raw JSON value of [departureDate].
                     *
                     * Unlike [departureDate], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("departure_date")
                    @ExcludeMissing
                    fun _departureDate(): JsonField<LocalDate> = departureDate

                    /**
                     * Returns the raw JSON value of [originationCityAirportCode].
                     *
                     * Unlike [originationCityAirportCode], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("origination_city_airport_code")
                    @ExcludeMissing
                    fun _originationCityAirportCode(): JsonField<String> =
                        originationCityAirportCode

                    /**
                     * Returns the raw JSON value of [passengerName].
                     *
                     * Unlike [passengerName], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("passenger_name")
                    @ExcludeMissing
                    fun _passengerName(): JsonField<String> = passengerName

                    /**
                     * Returns the raw JSON value of [restrictedTicketIndicator].
                     *
                     * Unlike [restrictedTicketIndicator], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("restricted_ticket_indicator")
                    @ExcludeMissing
                    fun _restrictedTicketIndicator(): JsonField<RestrictedTicketIndicator> =
                        restrictedTicketIndicator

                    /**
                     * Returns the raw JSON value of [ticketChangeIndicator].
                     *
                     * Unlike [ticketChangeIndicator], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("ticket_change_indicator")
                    @ExcludeMissing
                    fun _ticketChangeIndicator(): JsonField<TicketChangeIndicator> =
                        ticketChangeIndicator

                    /**
                     * Returns the raw JSON value of [ticketNumber].
                     *
                     * Unlike [ticketNumber], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("ticket_number")
                    @ExcludeMissing
                    fun _ticketNumber(): JsonField<String> = ticketNumber

                    /**
                     * Returns the raw JSON value of [travelAgencyCode].
                     *
                     * Unlike [travelAgencyCode], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("travel_agency_code")
                    @ExcludeMissing
                    fun _travelAgencyCode(): JsonField<String> = travelAgencyCode

                    /**
                     * Returns the raw JSON value of [travelAgencyName].
                     *
                     * Unlike [travelAgencyName], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("travel_agency_name")
                    @ExcludeMissing
                    fun _travelAgencyName(): JsonField<String> = travelAgencyName

                    /**
                     * Returns the raw JSON value of [tripLegs].
                     *
                     * Unlike [tripLegs], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("trip_legs")
                    @ExcludeMissing
                    fun _tripLegs(): JsonField<List<TripLeg>> = tripLegs

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Travel].
                         *
                         * The following fields are required:
                         * ```java
                         * .ancillary()
                         * .computerizedReservationSystem()
                         * .creditReasonIndicator()
                         * .departureDate()
                         * .originationCityAirportCode()
                         * .passengerName()
                         * .restrictedTicketIndicator()
                         * .ticketChangeIndicator()
                         * .ticketNumber()
                         * .travelAgencyCode()
                         * .travelAgencyName()
                         * .tripLegs()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Travel]. */
                    class Builder internal constructor() {

                        private var ancillary: JsonField<Ancillary>? = null
                        private var computerizedReservationSystem: JsonField<String>? = null
                        private var creditReasonIndicator: JsonField<CreditReasonIndicator>? = null
                        private var departureDate: JsonField<LocalDate>? = null
                        private var originationCityAirportCode: JsonField<String>? = null
                        private var passengerName: JsonField<String>? = null
                        private var restrictedTicketIndicator:
                            JsonField<RestrictedTicketIndicator>? =
                            null
                        private var ticketChangeIndicator: JsonField<TicketChangeIndicator>? = null
                        private var ticketNumber: JsonField<String>? = null
                        private var travelAgencyCode: JsonField<String>? = null
                        private var travelAgencyName: JsonField<String>? = null
                        private var tripLegs: JsonField<MutableList<TripLeg>>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(travel: Travel) = apply {
                            ancillary = travel.ancillary
                            computerizedReservationSystem = travel.computerizedReservationSystem
                            creditReasonIndicator = travel.creditReasonIndicator
                            departureDate = travel.departureDate
                            originationCityAirportCode = travel.originationCityAirportCode
                            passengerName = travel.passengerName
                            restrictedTicketIndicator = travel.restrictedTicketIndicator
                            ticketChangeIndicator = travel.ticketChangeIndicator
                            ticketNumber = travel.ticketNumber
                            travelAgencyCode = travel.travelAgencyCode
                            travelAgencyName = travel.travelAgencyName
                            tripLegs = travel.tripLegs.map { it.toMutableList() }
                            additionalProperties = travel.additionalProperties.toMutableMap()
                        }

                        /** Ancillary purchases in addition to the airfare. */
                        fun ancillary(ancillary: Ancillary?) =
                            ancillary(JsonField.ofNullable(ancillary))

                        /** Alias for calling [Builder.ancillary] with `ancillary.orElse(null)`. */
                        fun ancillary(ancillary: Optional<Ancillary>) =
                            ancillary(ancillary.getOrNull())

                        /**
                         * Sets [Builder.ancillary] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.ancillary] with a well-typed [Ancillary]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun ancillary(ancillary: JsonField<Ancillary>) = apply {
                            this.ancillary = ancillary
                        }

                        /**
                         * Indicates the computerized reservation system used to book the ticket.
                         */
                        fun computerizedReservationSystem(computerizedReservationSystem: String?) =
                            computerizedReservationSystem(
                                JsonField.ofNullable(computerizedReservationSystem)
                            )

                        /**
                         * Alias for calling [Builder.computerizedReservationSystem] with
                         * `computerizedReservationSystem.orElse(null)`.
                         */
                        fun computerizedReservationSystem(
                            computerizedReservationSystem: Optional<String>
                        ) = computerizedReservationSystem(computerizedReservationSystem.getOrNull())

                        /**
                         * Sets [Builder.computerizedReservationSystem] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.computerizedReservationSystem] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun computerizedReservationSystem(
                            computerizedReservationSystem: JsonField<String>
                        ) = apply {
                            this.computerizedReservationSystem = computerizedReservationSystem
                        }

                        /** Indicates the reason for a credit to the cardholder. */
                        fun creditReasonIndicator(creditReasonIndicator: CreditReasonIndicator?) =
                            creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator))

                        /**
                         * Alias for calling [Builder.creditReasonIndicator] with
                         * `creditReasonIndicator.orElse(null)`.
                         */
                        fun creditReasonIndicator(
                            creditReasonIndicator: Optional<CreditReasonIndicator>
                        ) = creditReasonIndicator(creditReasonIndicator.getOrNull())

                        /**
                         * Sets [Builder.creditReasonIndicator] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.creditReasonIndicator] with a well-typed
                         * [CreditReasonIndicator] value instead. This method is primarily for
                         * setting the field to an undocumented or not yet supported value.
                         */
                        fun creditReasonIndicator(
                            creditReasonIndicator: JsonField<CreditReasonIndicator>
                        ) = apply { this.creditReasonIndicator = creditReasonIndicator }

                        /** Date of departure. */
                        fun departureDate(departureDate: LocalDate?) =
                            departureDate(JsonField.ofNullable(departureDate))

                        /**
                         * Alias for calling [Builder.departureDate] with
                         * `departureDate.orElse(null)`.
                         */
                        fun departureDate(departureDate: Optional<LocalDate>) =
                            departureDate(departureDate.getOrNull())

                        /**
                         * Sets [Builder.departureDate] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.departureDate] with a well-typed
                         * [LocalDate] value instead. This method is primarily for setting the field
                         * to an undocumented or not yet supported value.
                         */
                        fun departureDate(departureDate: JsonField<LocalDate>) = apply {
                            this.departureDate = departureDate
                        }

                        /** Code for the originating city or airport. */
                        fun originationCityAirportCode(originationCityAirportCode: String?) =
                            originationCityAirportCode(
                                JsonField.ofNullable(originationCityAirportCode)
                            )

                        /**
                         * Alias for calling [Builder.originationCityAirportCode] with
                         * `originationCityAirportCode.orElse(null)`.
                         */
                        fun originationCityAirportCode(
                            originationCityAirportCode: Optional<String>
                        ) = originationCityAirportCode(originationCityAirportCode.getOrNull())

                        /**
                         * Sets [Builder.originationCityAirportCode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.originationCityAirportCode] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun originationCityAirportCode(
                            originationCityAirportCode: JsonField<String>
                        ) = apply { this.originationCityAirportCode = originationCityAirportCode }

                        /** Name of the passenger. */
                        fun passengerName(passengerName: String?) =
                            passengerName(JsonField.ofNullable(passengerName))

                        /**
                         * Alias for calling [Builder.passengerName] with
                         * `passengerName.orElse(null)`.
                         */
                        fun passengerName(passengerName: Optional<String>) =
                            passengerName(passengerName.getOrNull())

                        /**
                         * Sets [Builder.passengerName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.passengerName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun passengerName(passengerName: JsonField<String>) = apply {
                            this.passengerName = passengerName
                        }

                        /** Indicates whether this ticket is non-refundable. */
                        fun restrictedTicketIndicator(
                            restrictedTicketIndicator: RestrictedTicketIndicator?
                        ) =
                            restrictedTicketIndicator(
                                JsonField.ofNullable(restrictedTicketIndicator)
                            )

                        /**
                         * Alias for calling [Builder.restrictedTicketIndicator] with
                         * `restrictedTicketIndicator.orElse(null)`.
                         */
                        fun restrictedTicketIndicator(
                            restrictedTicketIndicator: Optional<RestrictedTicketIndicator>
                        ) = restrictedTicketIndicator(restrictedTicketIndicator.getOrNull())

                        /**
                         * Sets [Builder.restrictedTicketIndicator] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.restrictedTicketIndicator] with a
                         * well-typed [RestrictedTicketIndicator] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun restrictedTicketIndicator(
                            restrictedTicketIndicator: JsonField<RestrictedTicketIndicator>
                        ) = apply { this.restrictedTicketIndicator = restrictedTicketIndicator }

                        /** Indicates why a ticket was changed. */
                        fun ticketChangeIndicator(ticketChangeIndicator: TicketChangeIndicator?) =
                            ticketChangeIndicator(JsonField.ofNullable(ticketChangeIndicator))

                        /**
                         * Alias for calling [Builder.ticketChangeIndicator] with
                         * `ticketChangeIndicator.orElse(null)`.
                         */
                        fun ticketChangeIndicator(
                            ticketChangeIndicator: Optional<TicketChangeIndicator>
                        ) = ticketChangeIndicator(ticketChangeIndicator.getOrNull())

                        /**
                         * Sets [Builder.ticketChangeIndicator] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.ticketChangeIndicator] with a well-typed
                         * [TicketChangeIndicator] value instead. This method is primarily for
                         * setting the field to an undocumented or not yet supported value.
                         */
                        fun ticketChangeIndicator(
                            ticketChangeIndicator: JsonField<TicketChangeIndicator>
                        ) = apply { this.ticketChangeIndicator = ticketChangeIndicator }

                        /** Ticket number. */
                        fun ticketNumber(ticketNumber: String?) =
                            ticketNumber(JsonField.ofNullable(ticketNumber))

                        /**
                         * Alias for calling [Builder.ticketNumber] with
                         * `ticketNumber.orElse(null)`.
                         */
                        fun ticketNumber(ticketNumber: Optional<String>) =
                            ticketNumber(ticketNumber.getOrNull())

                        /**
                         * Sets [Builder.ticketNumber] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.ticketNumber] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun ticketNumber(ticketNumber: JsonField<String>) = apply {
                            this.ticketNumber = ticketNumber
                        }

                        /**
                         * Code for the travel agency if the ticket was issued by a travel agency.
                         */
                        fun travelAgencyCode(travelAgencyCode: String?) =
                            travelAgencyCode(JsonField.ofNullable(travelAgencyCode))

                        /**
                         * Alias for calling [Builder.travelAgencyCode] with
                         * `travelAgencyCode.orElse(null)`.
                         */
                        fun travelAgencyCode(travelAgencyCode: Optional<String>) =
                            travelAgencyCode(travelAgencyCode.getOrNull())

                        /**
                         * Sets [Builder.travelAgencyCode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.travelAgencyCode] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun travelAgencyCode(travelAgencyCode: JsonField<String>) = apply {
                            this.travelAgencyCode = travelAgencyCode
                        }

                        /**
                         * Name of the travel agency if the ticket was issued by a travel agency.
                         */
                        fun travelAgencyName(travelAgencyName: String?) =
                            travelAgencyName(JsonField.ofNullable(travelAgencyName))

                        /**
                         * Alias for calling [Builder.travelAgencyName] with
                         * `travelAgencyName.orElse(null)`.
                         */
                        fun travelAgencyName(travelAgencyName: Optional<String>) =
                            travelAgencyName(travelAgencyName.getOrNull())

                        /**
                         * Sets [Builder.travelAgencyName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.travelAgencyName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun travelAgencyName(travelAgencyName: JsonField<String>) = apply {
                            this.travelAgencyName = travelAgencyName
                        }

                        /** Fields specific to each leg of the journey. */
                        fun tripLegs(tripLegs: List<TripLeg>?) =
                            tripLegs(JsonField.ofNullable(tripLegs))

                        /** Alias for calling [Builder.tripLegs] with `tripLegs.orElse(null)`. */
                        fun tripLegs(tripLegs: Optional<List<TripLeg>>) =
                            tripLegs(tripLegs.getOrNull())

                        /**
                         * Sets [Builder.tripLegs] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.tripLegs] with a well-typed
                         * `List<TripLeg>` value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun tripLegs(tripLegs: JsonField<List<TripLeg>>) = apply {
                            this.tripLegs = tripLegs.map { it.toMutableList() }
                        }

                        /**
                         * Adds a single [TripLeg] to [tripLegs].
                         *
                         * @throws IllegalStateException if the field was previously set to a
                         *   non-list.
                         */
                        fun addTripLeg(tripLeg: TripLeg) = apply {
                            tripLegs =
                                (tripLegs ?: JsonField.of(mutableListOf())).also {
                                    checkKnown("tripLegs", it).add(tripLeg)
                                }
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Travel].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .ancillary()
                         * .computerizedReservationSystem()
                         * .creditReasonIndicator()
                         * .departureDate()
                         * .originationCityAirportCode()
                         * .passengerName()
                         * .restrictedTicketIndicator()
                         * .ticketChangeIndicator()
                         * .ticketNumber()
                         * .travelAgencyCode()
                         * .travelAgencyName()
                         * .tripLegs()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Travel =
                            Travel(
                                checkRequired("ancillary", ancillary),
                                checkRequired(
                                    "computerizedReservationSystem",
                                    computerizedReservationSystem,
                                ),
                                checkRequired("creditReasonIndicator", creditReasonIndicator),
                                checkRequired("departureDate", departureDate),
                                checkRequired(
                                    "originationCityAirportCode",
                                    originationCityAirportCode,
                                ),
                                checkRequired("passengerName", passengerName),
                                checkRequired(
                                    "restrictedTicketIndicator",
                                    restrictedTicketIndicator,
                                ),
                                checkRequired("ticketChangeIndicator", ticketChangeIndicator),
                                checkRequired("ticketNumber", ticketNumber),
                                checkRequired("travelAgencyCode", travelAgencyCode),
                                checkRequired("travelAgencyName", travelAgencyName),
                                checkRequired("tripLegs", tripLegs).map { it.toImmutable() },
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Travel = apply {
                        if (validated) {
                            return@apply
                        }

                        ancillary().ifPresent { it.validate() }
                        computerizedReservationSystem()
                        creditReasonIndicator().ifPresent { it.validate() }
                        departureDate()
                        originationCityAirportCode()
                        passengerName()
                        restrictedTicketIndicator().ifPresent { it.validate() }
                        ticketChangeIndicator().ifPresent { it.validate() }
                        ticketNumber()
                        travelAgencyCode()
                        travelAgencyName()
                        tripLegs().ifPresent { it.forEach { it.validate() } }
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (ancillary.asKnown().getOrNull()?.validity() ?: 0) +
                            (if (computerizedReservationSystem.asKnown().isPresent) 1 else 0) +
                            (creditReasonIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                            (if (departureDate.asKnown().isPresent) 1 else 0) +
                            (if (originationCityAirportCode.asKnown().isPresent) 1 else 0) +
                            (if (passengerName.asKnown().isPresent) 1 else 0) +
                            (restrictedTicketIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                            (ticketChangeIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                            (if (ticketNumber.asKnown().isPresent) 1 else 0) +
                            (if (travelAgencyCode.asKnown().isPresent) 1 else 0) +
                            (if (travelAgencyName.asKnown().isPresent) 1 else 0) +
                            (tripLegs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)

                    /** Ancillary purchases in addition to the airfare. */
                    class Ancillary
                    @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                    private constructor(
                        private val connectedTicketDocumentNumber: JsonField<String>,
                        private val creditReasonIndicator: JsonField<CreditReasonIndicator>,
                        private val passengerNameOrDescription: JsonField<String>,
                        private val services: JsonField<List<Service>>,
                        private val ticketDocumentNumber: JsonField<String>,
                        private val additionalProperties: MutableMap<String, JsonValue>,
                    ) {

                        @JsonCreator
                        private constructor(
                            @JsonProperty("connected_ticket_document_number")
                            @ExcludeMissing
                            connectedTicketDocumentNumber: JsonField<String> = JsonMissing.of(),
                            @JsonProperty("credit_reason_indicator")
                            @ExcludeMissing
                            creditReasonIndicator: JsonField<CreditReasonIndicator> =
                                JsonMissing.of(),
                            @JsonProperty("passenger_name_or_description")
                            @ExcludeMissing
                            passengerNameOrDescription: JsonField<String> = JsonMissing.of(),
                            @JsonProperty("services")
                            @ExcludeMissing
                            services: JsonField<List<Service>> = JsonMissing.of(),
                            @JsonProperty("ticket_document_number")
                            @ExcludeMissing
                            ticketDocumentNumber: JsonField<String> = JsonMissing.of(),
                        ) : this(
                            connectedTicketDocumentNumber,
                            creditReasonIndicator,
                            passengerNameOrDescription,
                            services,
                            ticketDocumentNumber,
                            mutableMapOf(),
                        )

                        /**
                         * If this purchase has a connection or relationship to another purchase,
                         * such as a baggage fee for a passenger transport ticket, this field should
                         * contain the ticket document number for the other purchase.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun connectedTicketDocumentNumber(): Optional<String> =
                            connectedTicketDocumentNumber.getOptional(
                                "connected_ticket_document_number"
                            )

                        /**
                         * Indicates the reason for a credit to the cardholder.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun creditReasonIndicator(): Optional<CreditReasonIndicator> =
                            creditReasonIndicator.getOptional("credit_reason_indicator")

                        /**
                         * Name of the passenger or description of the ancillary purchase.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun passengerNameOrDescription(): Optional<String> =
                            passengerNameOrDescription.getOptional("passenger_name_or_description")

                        /**
                         * Additional travel charges, such as baggage fees.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type or is unexpectedly missing or null (e.g. if the server responded
                         *   with an unexpected value).
                         */
                        fun services(): List<Service> = services.getRequired("services")

                        /**
                         * Ticket document number.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun ticketDocumentNumber(): Optional<String> =
                            ticketDocumentNumber.getOptional("ticket_document_number")

                        /**
                         * Returns the raw JSON value of [connectedTicketDocumentNumber].
                         *
                         * Unlike [connectedTicketDocumentNumber], this method doesn't throw if the
                         * JSON field has an unexpected type.
                         */
                        @JsonProperty("connected_ticket_document_number")
                        @ExcludeMissing
                        fun _connectedTicketDocumentNumber(): JsonField<String> =
                            connectedTicketDocumentNumber

                        /**
                         * Returns the raw JSON value of [creditReasonIndicator].
                         *
                         * Unlike [creditReasonIndicator], this method doesn't throw if the JSON
                         * field has an unexpected type.
                         */
                        @JsonProperty("credit_reason_indicator")
                        @ExcludeMissing
                        fun _creditReasonIndicator(): JsonField<CreditReasonIndicator> =
                            creditReasonIndicator

                        /**
                         * Returns the raw JSON value of [passengerNameOrDescription].
                         *
                         * Unlike [passengerNameOrDescription], this method doesn't throw if the
                         * JSON field has an unexpected type.
                         */
                        @JsonProperty("passenger_name_or_description")
                        @ExcludeMissing
                        fun _passengerNameOrDescription(): JsonField<String> =
                            passengerNameOrDescription

                        /**
                         * Returns the raw JSON value of [services].
                         *
                         * Unlike [services], this method doesn't throw if the JSON field has an
                         * unexpected type.
                         */
                        @JsonProperty("services")
                        @ExcludeMissing
                        fun _services(): JsonField<List<Service>> = services

                        /**
                         * Returns the raw JSON value of [ticketDocumentNumber].
                         *
                         * Unlike [ticketDocumentNumber], this method doesn't throw if the JSON
                         * field has an unexpected type.
                         */
                        @JsonProperty("ticket_document_number")
                        @ExcludeMissing
                        fun _ticketDocumentNumber(): JsonField<String> = ticketDocumentNumber

                        @JsonAnySetter
                        private fun putAdditionalProperty(key: String, value: JsonValue) {
                            additionalProperties.put(key, value)
                        }

                        @JsonAnyGetter
                        @ExcludeMissing
                        fun _additionalProperties(): Map<String, JsonValue> =
                            Collections.unmodifiableMap(additionalProperties)

                        fun toBuilder() = Builder().from(this)

                        companion object {

                            /**
                             * Returns a mutable builder for constructing an instance of
                             * [Ancillary].
                             *
                             * The following fields are required:
                             * ```java
                             * .connectedTicketDocumentNumber()
                             * .creditReasonIndicator()
                             * .passengerNameOrDescription()
                             * .services()
                             * .ticketDocumentNumber()
                             * ```
                             */
                            @JvmStatic fun builder() = Builder()
                        }

                        /** A builder for [Ancillary]. */
                        class Builder internal constructor() {

                            private var connectedTicketDocumentNumber: JsonField<String>? = null
                            private var creditReasonIndicator: JsonField<CreditReasonIndicator>? =
                                null
                            private var passengerNameOrDescription: JsonField<String>? = null
                            private var services: JsonField<MutableList<Service>>? = null
                            private var ticketDocumentNumber: JsonField<String>? = null
                            private var additionalProperties: MutableMap<String, JsonValue> =
                                mutableMapOf()

                            @JvmSynthetic
                            internal fun from(ancillary: Ancillary) = apply {
                                connectedTicketDocumentNumber =
                                    ancillary.connectedTicketDocumentNumber
                                creditReasonIndicator = ancillary.creditReasonIndicator
                                passengerNameOrDescription = ancillary.passengerNameOrDescription
                                services = ancillary.services.map { it.toMutableList() }
                                ticketDocumentNumber = ancillary.ticketDocumentNumber
                                additionalProperties = ancillary.additionalProperties.toMutableMap()
                            }

                            /**
                             * If this purchase has a connection or relationship to another
                             * purchase, such as a baggage fee for a passenger transport ticket,
                             * this field should contain the ticket document number for the other
                             * purchase.
                             */
                            fun connectedTicketDocumentNumber(
                                connectedTicketDocumentNumber: String?
                            ) =
                                connectedTicketDocumentNumber(
                                    JsonField.ofNullable(connectedTicketDocumentNumber)
                                )

                            /**
                             * Alias for calling [Builder.connectedTicketDocumentNumber] with
                             * `connectedTicketDocumentNumber.orElse(null)`.
                             */
                            fun connectedTicketDocumentNumber(
                                connectedTicketDocumentNumber: Optional<String>
                            ) =
                                connectedTicketDocumentNumber(
                                    connectedTicketDocumentNumber.getOrNull()
                                )

                            /**
                             * Sets [Builder.connectedTicketDocumentNumber] to an arbitrary JSON
                             * value.
                             *
                             * You should usually call [Builder.connectedTicketDocumentNumber] with
                             * a well-typed [String] value instead. This method is primarily for
                             * setting the field to an undocumented or not yet supported value.
                             */
                            fun connectedTicketDocumentNumber(
                                connectedTicketDocumentNumber: JsonField<String>
                            ) = apply {
                                this.connectedTicketDocumentNumber = connectedTicketDocumentNumber
                            }

                            /** Indicates the reason for a credit to the cardholder. */
                            fun creditReasonIndicator(
                                creditReasonIndicator: CreditReasonIndicator?
                            ) = creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator))

                            /**
                             * Alias for calling [Builder.creditReasonIndicator] with
                             * `creditReasonIndicator.orElse(null)`.
                             */
                            fun creditReasonIndicator(
                                creditReasonIndicator: Optional<CreditReasonIndicator>
                            ) = creditReasonIndicator(creditReasonIndicator.getOrNull())

                            /**
                             * Sets [Builder.creditReasonIndicator] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.creditReasonIndicator] with a
                             * well-typed [CreditReasonIndicator] value instead. This method is
                             * primarily for setting the field to an undocumented or not yet
                             * supported value.
                             */
                            fun creditReasonIndicator(
                                creditReasonIndicator: JsonField<CreditReasonIndicator>
                            ) = apply { this.creditReasonIndicator = creditReasonIndicator }

                            /** Name of the passenger or description of the ancillary purchase. */
                            fun passengerNameOrDescription(passengerNameOrDescription: String?) =
                                passengerNameOrDescription(
                                    JsonField.ofNullable(passengerNameOrDescription)
                                )

                            /**
                             * Alias for calling [Builder.passengerNameOrDescription] with
                             * `passengerNameOrDescription.orElse(null)`.
                             */
                            fun passengerNameOrDescription(
                                passengerNameOrDescription: Optional<String>
                            ) = passengerNameOrDescription(passengerNameOrDescription.getOrNull())

                            /**
                             * Sets [Builder.passengerNameOrDescription] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.passengerNameOrDescription] with a
                             * well-typed [String] value instead. This method is primarily for
                             * setting the field to an undocumented or not yet supported value.
                             */
                            fun passengerNameOrDescription(
                                passengerNameOrDescription: JsonField<String>
                            ) = apply {
                                this.passengerNameOrDescription = passengerNameOrDescription
                            }

                            /** Additional travel charges, such as baggage fees. */
                            fun services(services: List<Service>) = services(JsonField.of(services))

                            /**
                             * Sets [Builder.services] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.services] with a well-typed
                             * `List<Service>` value instead. This method is primarily for setting
                             * the field to an undocumented or not yet supported value.
                             */
                            fun services(services: JsonField<List<Service>>) = apply {
                                this.services = services.map { it.toMutableList() }
                            }

                            /**
                             * Adds a single [Service] to [services].
                             *
                             * @throws IllegalStateException if the field was previously set to a
                             *   non-list.
                             */
                            fun addService(service: Service) = apply {
                                services =
                                    (services ?: JsonField.of(mutableListOf())).also {
                                        checkKnown("services", it).add(service)
                                    }
                            }

                            /** Ticket document number. */
                            fun ticketDocumentNumber(ticketDocumentNumber: String?) =
                                ticketDocumentNumber(JsonField.ofNullable(ticketDocumentNumber))

                            /**
                             * Alias for calling [Builder.ticketDocumentNumber] with
                             * `ticketDocumentNumber.orElse(null)`.
                             */
                            fun ticketDocumentNumber(ticketDocumentNumber: Optional<String>) =
                                ticketDocumentNumber(ticketDocumentNumber.getOrNull())

                            /**
                             * Sets [Builder.ticketDocumentNumber] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.ticketDocumentNumber] with a
                             * well-typed [String] value instead. This method is primarily for
                             * setting the field to an undocumented or not yet supported value.
                             */
                            fun ticketDocumentNumber(ticketDocumentNumber: JsonField<String>) =
                                apply {
                                    this.ticketDocumentNumber = ticketDocumentNumber
                                }

                            fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                                apply {
                                    this.additionalProperties.clear()
                                    putAllAdditionalProperties(additionalProperties)
                                }

                            fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                                additionalProperties.put(key, value)
                            }

                            fun putAllAdditionalProperties(
                                additionalProperties: Map<String, JsonValue>
                            ) = apply { this.additionalProperties.putAll(additionalProperties) }

                            fun removeAdditionalProperty(key: String) = apply {
                                additionalProperties.remove(key)
                            }

                            fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                                keys.forEach(::removeAdditionalProperty)
                            }

                            /**
                             * Returns an immutable instance of [Ancillary].
                             *
                             * Further updates to this [Builder] will not mutate the returned
                             * instance.
                             *
                             * The following fields are required:
                             * ```java
                             * .connectedTicketDocumentNumber()
                             * .creditReasonIndicator()
                             * .passengerNameOrDescription()
                             * .services()
                             * .ticketDocumentNumber()
                             * ```
                             *
                             * @throws IllegalStateException if any required field is unset.
                             */
                            fun build(): Ancillary =
                                Ancillary(
                                    checkRequired(
                                        "connectedTicketDocumentNumber",
                                        connectedTicketDocumentNumber,
                                    ),
                                    checkRequired("creditReasonIndicator", creditReasonIndicator),
                                    checkRequired(
                                        "passengerNameOrDescription",
                                        passengerNameOrDescription,
                                    ),
                                    checkRequired("services", services).map { it.toImmutable() },
                                    checkRequired("ticketDocumentNumber", ticketDocumentNumber),
                                    additionalProperties.toMutableMap(),
                                )
                        }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): Ancillary = apply {
                            if (validated) {
                                return@apply
                            }

                            connectedTicketDocumentNumber()
                            creditReasonIndicator().ifPresent { it.validate() }
                            passengerNameOrDescription()
                            services().forEach { it.validate() }
                            ticketDocumentNumber()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int =
                            (if (connectedTicketDocumentNumber.asKnown().isPresent) 1 else 0) +
                                (creditReasonIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                                (if (passengerNameOrDescription.asKnown().isPresent) 1 else 0) +
                                (services.asKnown().getOrNull()?.sumOf { it.validity().toInt() }
                                    ?: 0) +
                                (if (ticketDocumentNumber.asKnown().isPresent) 1 else 0)

                        /** Indicates the reason for a credit to the cardholder. */
                        class CreditReasonIndicator
                        @JsonCreator
                        private constructor(private val value: JsonField<String>) : Enum {

                            /**
                             * Returns this class instance's raw value.
                             *
                             * This is usually only useful if this instance was deserialized from
                             * data that doesn't match any known member, and you want to know that
                             * value. For example, if the SDK is on an older version than the API,
                             * then the API may respond with new members that the SDK is unaware of.
                             */
                            @com.fasterxml.jackson.annotation.JsonValue
                            fun _value(): JsonField<String> = value

                            companion object {

                                /** No credit */
                                @JvmField val NO_CREDIT = of("no_credit")

                                /** Passenger transport ancillary purchase cancellation */
                                @JvmField
                                val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION =
                                    of("passenger_transport_ancillary_purchase_cancellation")

                                /**
                                 * Airline ticket and passenger transport ancillary purchase
                                 * cancellation
                                 */
                                @JvmField
                                val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION =
                                    of(
                                        "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation"
                                    )

                                /** Other */
                                @JvmField val OTHER = of("other")

                                @JvmStatic
                                fun of(value: String) = CreditReasonIndicator(JsonField.of(value))
                            }

                            /** An enum containing [CreditReasonIndicator]'s known values. */
                            enum class Known {
                                /** No credit */
                                NO_CREDIT,
                                /** Passenger transport ancillary purchase cancellation */
                                PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION,
                                /**
                                 * Airline ticket and passenger transport ancillary purchase
                                 * cancellation
                                 */
                                AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION,
                                /** Other */
                                OTHER,
                            }

                            /**
                             * An enum containing [CreditReasonIndicator]'s known values, as well as
                             * an [_UNKNOWN] member.
                             *
                             * An instance of [CreditReasonIndicator] can contain an unknown value
                             * in a couple of cases:
                             * - It was deserialized from data that doesn't match any known member.
                             *   For example, if the SDK is on an older version than the API, then
                             *   the API may respond with new members that the SDK is unaware of.
                             * - It was constructed with an arbitrary value using the [of] method.
                             */
                            enum class Value {
                                /** No credit */
                                NO_CREDIT,
                                /** Passenger transport ancillary purchase cancellation */
                                PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION,
                                /**
                                 * Airline ticket and passenger transport ancillary purchase
                                 * cancellation
                                 */
                                AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION,
                                /** Other */
                                OTHER,
                                /**
                                 * An enum member indicating that [CreditReasonIndicator] was
                                 * instantiated with an unknown value.
                                 */
                                _UNKNOWN,
                            }

                            /**
                             * Returns an enum member corresponding to this class instance's value,
                             * or [Value._UNKNOWN] if the class was instantiated with an unknown
                             * value.
                             *
                             * Use the [known] method instead if you're certain the value is always
                             * known or if you want to throw for the unknown case.
                             */
                            fun value(): Value =
                                when (this) {
                                    NO_CREDIT -> Value.NO_CREDIT
                                    PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION ->
                                        Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION
                                    AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION ->
                                        Value
                                            .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION
                                    OTHER -> Value.OTHER
                                    else -> Value._UNKNOWN
                                }

                            /**
                             * Returns an enum member corresponding to this class instance's value.
                             *
                             * Use the [value] method instead if you're uncertain the value is
                             * always known and don't want to throw for the unknown case.
                             *
                             * @throws IncreaseInvalidDataException if this class instance's value
                             *   is a not a known member.
                             */
                            fun known(): Known =
                                when (this) {
                                    NO_CREDIT -> Known.NO_CREDIT
                                    PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION ->
                                        Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION
                                    AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION ->
                                        Known
                                            .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION
                                    OTHER -> Known.OTHER
                                    else ->
                                        throw IncreaseInvalidDataException(
                                            "Unknown CreditReasonIndicator: $value"
                                        )
                                }

                            /**
                             * Returns this class instance's primitive wire representation.
                             *
                             * This differs from the [toString] method because that method is
                             * primarily for debugging and generally doesn't throw.
                             *
                             * @throws IncreaseInvalidDataException if this class instance's value
                             *   does not have the expected primitive type.
                             */
                            fun asString(): String =
                                _value().asString().orElseThrow {
                                    IncreaseInvalidDataException("Value is not a String")
                                }

                            private var validated: Boolean = false

                            /**
                             * Validates that the types of all values in this object match their
                             * expected types recursively.
                             *
                             * This method is _not_ forwards compatible with new types from the API
                             * for existing fields.
                             *
                             * @throws IncreaseInvalidDataException if any value type in this object
                             *   doesn't match its expected type.
                             */
                            fun validate(): CreditReasonIndicator = apply {
                                if (validated) {
                                    return@apply
                                }

                                known()
                                validated = true
                            }

                            fun isValid(): Boolean =
                                try {
                                    validate()
                                    true
                                } catch (e: IncreaseInvalidDataException) {
                                    false
                                }

                            /**
                             * Returns a score indicating how many valid values are contained in
                             * this object recursively.
                             *
                             * Used for best match union deserialization.
                             */
                            @JvmSynthetic
                            internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                            override fun equals(other: Any?): Boolean {
                                if (this === other) {
                                    return true
                                }

                                return other is CreditReasonIndicator && value == other.value
                            }

                            override fun hashCode() = value.hashCode()

                            override fun toString() = value.toString()
                        }

                        class Service
                        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                        private constructor(
                            private val category: JsonField<Category>,
                            private val subCategory: JsonField<String>,
                            private val additionalProperties: MutableMap<String, JsonValue>,
                        ) {

                            @JsonCreator
                            private constructor(
                                @JsonProperty("category")
                                @ExcludeMissing
                                category: JsonField<Category> = JsonMissing.of(),
                                @JsonProperty("sub_category")
                                @ExcludeMissing
                                subCategory: JsonField<String> = JsonMissing.of(),
                            ) : this(category, subCategory, mutableMapOf())

                            /**
                             * Category of the ancillary service.
                             *
                             * @throws IncreaseInvalidDataException if the JSON field has an
                             *   unexpected type (e.g. if the server responded with an unexpected
                             *   value).
                             */
                            fun category(): Optional<Category> = category.getOptional("category")

                            /**
                             * Sub-category of the ancillary service, free-form.
                             *
                             * @throws IncreaseInvalidDataException if the JSON field has an
                             *   unexpected type (e.g. if the server responded with an unexpected
                             *   value).
                             */
                            fun subCategory(): Optional<String> =
                                subCategory.getOptional("sub_category")

                            /**
                             * Returns the raw JSON value of [category].
                             *
                             * Unlike [category], this method doesn't throw if the JSON field has an
                             * unexpected type.
                             */
                            @JsonProperty("category")
                            @ExcludeMissing
                            fun _category(): JsonField<Category> = category

                            /**
                             * Returns the raw JSON value of [subCategory].
                             *
                             * Unlike [subCategory], this method doesn't throw if the JSON field has
                             * an unexpected type.
                             */
                            @JsonProperty("sub_category")
                            @ExcludeMissing
                            fun _subCategory(): JsonField<String> = subCategory

                            @JsonAnySetter
                            private fun putAdditionalProperty(key: String, value: JsonValue) {
                                additionalProperties.put(key, value)
                            }

                            @JsonAnyGetter
                            @ExcludeMissing
                            fun _additionalProperties(): Map<String, JsonValue> =
                                Collections.unmodifiableMap(additionalProperties)

                            fun toBuilder() = Builder().from(this)

                            companion object {

                                /**
                                 * Returns a mutable builder for constructing an instance of
                                 * [Service].
                                 *
                                 * The following fields are required:
                                 * ```java
                                 * .category()
                                 * .subCategory()
                                 * ```
                                 */
                                @JvmStatic fun builder() = Builder()
                            }

                            /** A builder for [Service]. */
                            class Builder internal constructor() {

                                private var category: JsonField<Category>? = null
                                private var subCategory: JsonField<String>? = null
                                private var additionalProperties: MutableMap<String, JsonValue> =
                                    mutableMapOf()

                                @JvmSynthetic
                                internal fun from(service: Service) = apply {
                                    category = service.category
                                    subCategory = service.subCategory
                                    additionalProperties =
                                        service.additionalProperties.toMutableMap()
                                }

                                /** Category of the ancillary service. */
                                fun category(category: Category?) =
                                    category(JsonField.ofNullable(category))

                                /**
                                 * Alias for calling [Builder.category] with
                                 * `category.orElse(null)`.
                                 */
                                fun category(category: Optional<Category>) =
                                    category(category.getOrNull())

                                /**
                                 * Sets [Builder.category] to an arbitrary JSON value.
                                 *
                                 * You should usually call [Builder.category] with a well-typed
                                 * [Category] value instead. This method is primarily for setting
                                 * the field to an undocumented or not yet supported value.
                                 */
                                fun category(category: JsonField<Category>) = apply {
                                    this.category = category
                                }

                                /** Sub-category of the ancillary service, free-form. */
                                fun subCategory(subCategory: String?) =
                                    subCategory(JsonField.ofNullable(subCategory))

                                /**
                                 * Alias for calling [Builder.subCategory] with
                                 * `subCategory.orElse(null)`.
                                 */
                                fun subCategory(subCategory: Optional<String>) =
                                    subCategory(subCategory.getOrNull())

                                /**
                                 * Sets [Builder.subCategory] to an arbitrary JSON value.
                                 *
                                 * You should usually call [Builder.subCategory] with a well-typed
                                 * [String] value instead. This method is primarily for setting the
                                 * field to an undocumented or not yet supported value.
                                 */
                                fun subCategory(subCategory: JsonField<String>) = apply {
                                    this.subCategory = subCategory
                                }

                                fun additionalProperties(
                                    additionalProperties: Map<String, JsonValue>
                                ) = apply {
                                    this.additionalProperties.clear()
                                    putAllAdditionalProperties(additionalProperties)
                                }

                                fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                                    additionalProperties.put(key, value)
                                }

                                fun putAllAdditionalProperties(
                                    additionalProperties: Map<String, JsonValue>
                                ) = apply { this.additionalProperties.putAll(additionalProperties) }

                                fun removeAdditionalProperty(key: String) = apply {
                                    additionalProperties.remove(key)
                                }

                                fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                                    keys.forEach(::removeAdditionalProperty)
                                }

                                /**
                                 * Returns an immutable instance of [Service].
                                 *
                                 * Further updates to this [Builder] will not mutate the returned
                                 * instance.
                                 *
                                 * The following fields are required:
                                 * ```java
                                 * .category()
                                 * .subCategory()
                                 * ```
                                 *
                                 * @throws IllegalStateException if any required field is unset.
                                 */
                                fun build(): Service =
                                    Service(
                                        checkRequired("category", category),
                                        checkRequired("subCategory", subCategory),
                                        additionalProperties.toMutableMap(),
                                    )
                            }

                            private var validated: Boolean = false

                            /**
                             * Validates that the types of all values in this object match their
                             * expected types recursively.
                             *
                             * This method is _not_ forwards compatible with new types from the API
                             * for existing fields.
                             *
                             * @throws IncreaseInvalidDataException if any value type in this object
                             *   doesn't match its expected type.
                             */
                            fun validate(): Service = apply {
                                if (validated) {
                                    return@apply
                                }

                                category().ifPresent { it.validate() }
                                subCategory()
                                validated = true
                            }

                            fun isValid(): Boolean =
                                try {
                                    validate()
                                    true
                                } catch (e: IncreaseInvalidDataException) {
                                    false
                                }

                            /**
                             * Returns a score indicating how many valid values are contained in
                             * this object recursively.
                             *
                             * Used for best match union deserialization.
                             */
                            @JvmSynthetic
                            internal fun validity(): Int =
                                (category.asKnown().getOrNull()?.validity() ?: 0) +
                                    (if (subCategory.asKnown().isPresent) 1 else 0)

                            /** Category of the ancillary service. */
                            class Category
                            @JsonCreator
                            private constructor(private val value: JsonField<String>) : Enum {

                                /**
                                 * Returns this class instance's raw value.
                                 *
                                 * This is usually only useful if this instance was deserialized
                                 * from data that doesn't match any known member, and you want to
                                 * know that value. For example, if the SDK is on an older version
                                 * than the API, then the API may respond with new members that the
                                 * SDK is unaware of.
                                 */
                                @com.fasterxml.jackson.annotation.JsonValue
                                fun _value(): JsonField<String> = value

                                companion object {

                                    /** None */
                                    @JvmField val NONE = of("none")

                                    /** Bundled service */
                                    @JvmField val BUNDLED_SERVICE = of("bundled_service")

                                    /** Baggage fee */
                                    @JvmField val BAGGAGE_FEE = of("baggage_fee")

                                    /** Change fee */
                                    @JvmField val CHANGE_FEE = of("change_fee")

                                    /** Cargo */
                                    @JvmField val CARGO = of("cargo")

                                    /** Carbon offset */
                                    @JvmField val CARBON_OFFSET = of("carbon_offset")

                                    /** Frequent flyer */
                                    @JvmField val FREQUENT_FLYER = of("frequent_flyer")

                                    /** Gift card */
                                    @JvmField val GIFT_CARD = of("gift_card")

                                    /** Ground transport */
                                    @JvmField val GROUND_TRANSPORT = of("ground_transport")

                                    /** In-flight entertainment */
                                    @JvmField
                                    val IN_FLIGHT_ENTERTAINMENT = of("in_flight_entertainment")

                                    /** Lounge */
                                    @JvmField val LOUNGE = of("lounge")

                                    /** Medical */
                                    @JvmField val MEDICAL = of("medical")

                                    /** Meal beverage */
                                    @JvmField val MEAL_BEVERAGE = of("meal_beverage")

                                    /** Other */
                                    @JvmField val OTHER = of("other")

                                    /** Passenger assist fee */
                                    @JvmField val PASSENGER_ASSIST_FEE = of("passenger_assist_fee")

                                    /** Pets */
                                    @JvmField val PETS = of("pets")

                                    /** Seat fees */
                                    @JvmField val SEAT_FEES = of("seat_fees")

                                    /** Standby */
                                    @JvmField val STANDBY = of("standby")

                                    /** Service fee */
                                    @JvmField val SERVICE_FEE = of("service_fee")

                                    /** Store */
                                    @JvmField val STORE = of("store")

                                    /** Travel service */
                                    @JvmField val TRAVEL_SERVICE = of("travel_service")

                                    /** Unaccompanied travel */
                                    @JvmField val UNACCOMPANIED_TRAVEL = of("unaccompanied_travel")

                                    /** Upgrades */
                                    @JvmField val UPGRADES = of("upgrades")

                                    /** Wi-fi */
                                    @JvmField val WIFI = of("wifi")

                                    @JvmStatic fun of(value: String) = Category(JsonField.of(value))
                                }

                                /** An enum containing [Category]'s known values. */
                                enum class Known {
                                    /** None */
                                    NONE,
                                    /** Bundled service */
                                    BUNDLED_SERVICE,
                                    /** Baggage fee */
                                    BAGGAGE_FEE,
                                    /** Change fee */
                                    CHANGE_FEE,
                                    /** Cargo */
                                    CARGO,
                                    /** Carbon offset */
                                    CARBON_OFFSET,
                                    /** Frequent flyer */
                                    FREQUENT_FLYER,
                                    /** Gift card */
                                    GIFT_CARD,
                                    /** Ground transport */
                                    GROUND_TRANSPORT,
                                    /** In-flight entertainment */
                                    IN_FLIGHT_ENTERTAINMENT,
                                    /** Lounge */
                                    LOUNGE,
                                    /** Medical */
                                    MEDICAL,
                                    /** Meal beverage */
                                    MEAL_BEVERAGE,
                                    /** Other */
                                    OTHER,
                                    /** Passenger assist fee */
                                    PASSENGER_ASSIST_FEE,
                                    /** Pets */
                                    PETS,
                                    /** Seat fees */
                                    SEAT_FEES,
                                    /** Standby */
                                    STANDBY,
                                    /** Service fee */
                                    SERVICE_FEE,
                                    /** Store */
                                    STORE,
                                    /** Travel service */
                                    TRAVEL_SERVICE,
                                    /** Unaccompanied travel */
                                    UNACCOMPANIED_TRAVEL,
                                    /** Upgrades */
                                    UPGRADES,
                                    /** Wi-fi */
                                    WIFI,
                                }

                                /**
                                 * An enum containing [Category]'s known values, as well as an
                                 * [_UNKNOWN] member.
                                 *
                                 * An instance of [Category] can contain an unknown value in a
                                 * couple of cases:
                                 * - It was deserialized from data that doesn't match any known
                                 *   member. For example, if the SDK is on an older version than the
                                 *   API, then the API may respond with new members that the SDK is
                                 *   unaware of.
                                 * - It was constructed with an arbitrary value using the [of]
                                 *   method.
                                 */
                                enum class Value {
                                    /** None */
                                    NONE,
                                    /** Bundled service */
                                    BUNDLED_SERVICE,
                                    /** Baggage fee */
                                    BAGGAGE_FEE,
                                    /** Change fee */
                                    CHANGE_FEE,
                                    /** Cargo */
                                    CARGO,
                                    /** Carbon offset */
                                    CARBON_OFFSET,
                                    /** Frequent flyer */
                                    FREQUENT_FLYER,
                                    /** Gift card */
                                    GIFT_CARD,
                                    /** Ground transport */
                                    GROUND_TRANSPORT,
                                    /** In-flight entertainment */
                                    IN_FLIGHT_ENTERTAINMENT,
                                    /** Lounge */
                                    LOUNGE,
                                    /** Medical */
                                    MEDICAL,
                                    /** Meal beverage */
                                    MEAL_BEVERAGE,
                                    /** Other */
                                    OTHER,
                                    /** Passenger assist fee */
                                    PASSENGER_ASSIST_FEE,
                                    /** Pets */
                                    PETS,
                                    /** Seat fees */
                                    SEAT_FEES,
                                    /** Standby */
                                    STANDBY,
                                    /** Service fee */
                                    SERVICE_FEE,
                                    /** Store */
                                    STORE,
                                    /** Travel service */
                                    TRAVEL_SERVICE,
                                    /** Unaccompanied travel */
                                    UNACCOMPANIED_TRAVEL,
                                    /** Upgrades */
                                    UPGRADES,
                                    /** Wi-fi */
                                    WIFI,
                                    /**
                                     * An enum member indicating that [Category] was instantiated
                                     * with an unknown value.
                                     */
                                    _UNKNOWN,
                                }

                                /**
                                 * Returns an enum member corresponding to this class instance's
                                 * value, or [Value._UNKNOWN] if the class was instantiated with an
                                 * unknown value.
                                 *
                                 * Use the [known] method instead if you're certain the value is
                                 * always known or if you want to throw for the unknown case.
                                 */
                                fun value(): Value =
                                    when (this) {
                                        NONE -> Value.NONE
                                        BUNDLED_SERVICE -> Value.BUNDLED_SERVICE
                                        BAGGAGE_FEE -> Value.BAGGAGE_FEE
                                        CHANGE_FEE -> Value.CHANGE_FEE
                                        CARGO -> Value.CARGO
                                        CARBON_OFFSET -> Value.CARBON_OFFSET
                                        FREQUENT_FLYER -> Value.FREQUENT_FLYER
                                        GIFT_CARD -> Value.GIFT_CARD
                                        GROUND_TRANSPORT -> Value.GROUND_TRANSPORT
                                        IN_FLIGHT_ENTERTAINMENT -> Value.IN_FLIGHT_ENTERTAINMENT
                                        LOUNGE -> Value.LOUNGE
                                        MEDICAL -> Value.MEDICAL
                                        MEAL_BEVERAGE -> Value.MEAL_BEVERAGE
                                        OTHER -> Value.OTHER
                                        PASSENGER_ASSIST_FEE -> Value.PASSENGER_ASSIST_FEE
                                        PETS -> Value.PETS
                                        SEAT_FEES -> Value.SEAT_FEES
                                        STANDBY -> Value.STANDBY
                                        SERVICE_FEE -> Value.SERVICE_FEE
                                        STORE -> Value.STORE
                                        TRAVEL_SERVICE -> Value.TRAVEL_SERVICE
                                        UNACCOMPANIED_TRAVEL -> Value.UNACCOMPANIED_TRAVEL
                                        UPGRADES -> Value.UPGRADES
                                        WIFI -> Value.WIFI
                                        else -> Value._UNKNOWN
                                    }

                                /**
                                 * Returns an enum member corresponding to this class instance's
                                 * value.
                                 *
                                 * Use the [value] method instead if you're uncertain the value is
                                 * always known and don't want to throw for the unknown case.
                                 *
                                 * @throws IncreaseInvalidDataException if this class instance's
                                 *   value is a not a known member.
                                 */
                                fun known(): Known =
                                    when (this) {
                                        NONE -> Known.NONE
                                        BUNDLED_SERVICE -> Known.BUNDLED_SERVICE
                                        BAGGAGE_FEE -> Known.BAGGAGE_FEE
                                        CHANGE_FEE -> Known.CHANGE_FEE
                                        CARGO -> Known.CARGO
                                        CARBON_OFFSET -> Known.CARBON_OFFSET
                                        FREQUENT_FLYER -> Known.FREQUENT_FLYER
                                        GIFT_CARD -> Known.GIFT_CARD
                                        GROUND_TRANSPORT -> Known.GROUND_TRANSPORT
                                        IN_FLIGHT_ENTERTAINMENT -> Known.IN_FLIGHT_ENTERTAINMENT
                                        LOUNGE -> Known.LOUNGE
                                        MEDICAL -> Known.MEDICAL
                                        MEAL_BEVERAGE -> Known.MEAL_BEVERAGE
                                        OTHER -> Known.OTHER
                                        PASSENGER_ASSIST_FEE -> Known.PASSENGER_ASSIST_FEE
                                        PETS -> Known.PETS
                                        SEAT_FEES -> Known.SEAT_FEES
                                        STANDBY -> Known.STANDBY
                                        SERVICE_FEE -> Known.SERVICE_FEE
                                        STORE -> Known.STORE
                                        TRAVEL_SERVICE -> Known.TRAVEL_SERVICE
                                        UNACCOMPANIED_TRAVEL -> Known.UNACCOMPANIED_TRAVEL
                                        UPGRADES -> Known.UPGRADES
                                        WIFI -> Known.WIFI
                                        else ->
                                            throw IncreaseInvalidDataException(
                                                "Unknown Category: $value"
                                            )
                                    }

                                /**
                                 * Returns this class instance's primitive wire representation.
                                 *
                                 * This differs from the [toString] method because that method is
                                 * primarily for debugging and generally doesn't throw.
                                 *
                                 * @throws IncreaseInvalidDataException if this class instance's
                                 *   value does not have the expected primitive type.
                                 */
                                fun asString(): String =
                                    _value().asString().orElseThrow {
                                        IncreaseInvalidDataException("Value is not a String")
                                    }

                                private var validated: Boolean = false

                                /**
                                 * Validates that the types of all values in this object match their
                                 * expected types recursively.
                                 *
                                 * This method is _not_ forwards compatible with new types from the
                                 * API for existing fields.
                                 *
                                 * @throws IncreaseInvalidDataException if any value type in this
                                 *   object doesn't match its expected type.
                                 */
                                fun validate(): Category = apply {
                                    if (validated) {
                                        return@apply
                                    }

                                    known()
                                    validated = true
                                }

                                fun isValid(): Boolean =
                                    try {
                                        validate()
                                        true
                                    } catch (e: IncreaseInvalidDataException) {
                                        false
                                    }

                                /**
                                 * Returns a score indicating how many valid values are contained in
                                 * this object recursively.
                                 *
                                 * Used for best match union deserialization.
                                 */
                                @JvmSynthetic
                                internal fun validity(): Int =
                                    if (value() == Value._UNKNOWN) 0 else 1

                                override fun equals(other: Any?): Boolean {
                                    if (this === other) {
                                        return true
                                    }

                                    return other is Category && value == other.value
                                }

                                override fun hashCode() = value.hashCode()

                                override fun toString() = value.toString()
                            }

                            override fun equals(other: Any?): Boolean {
                                if (this === other) {
                                    return true
                                }

                                return other is Service &&
                                    category == other.category &&
                                    subCategory == other.subCategory &&
                                    additionalProperties == other.additionalProperties
                            }

                            private val hashCode: Int by lazy {
                                Objects.hash(category, subCategory, additionalProperties)
                            }

                            override fun hashCode(): Int = hashCode

                            override fun toString() =
                                "Service{category=$category, subCategory=$subCategory, additionalProperties=$additionalProperties}"
                        }

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is Ancillary &&
                                connectedTicketDocumentNumber ==
                                    other.connectedTicketDocumentNumber &&
                                creditReasonIndicator == other.creditReasonIndicator &&
                                passengerNameOrDescription == other.passengerNameOrDescription &&
                                services == other.services &&
                                ticketDocumentNumber == other.ticketDocumentNumber &&
                                additionalProperties == other.additionalProperties
                        }

                        private val hashCode: Int by lazy {
                            Objects.hash(
                                connectedTicketDocumentNumber,
                                creditReasonIndicator,
                                passengerNameOrDescription,
                                services,
                                ticketDocumentNumber,
                                additionalProperties,
                            )
                        }

                        override fun hashCode(): Int = hashCode

                        override fun toString() =
                            "Ancillary{connectedTicketDocumentNumber=$connectedTicketDocumentNumber, creditReasonIndicator=$creditReasonIndicator, passengerNameOrDescription=$passengerNameOrDescription, services=$services, ticketDocumentNumber=$ticketDocumentNumber, additionalProperties=$additionalProperties}"
                    }

                    /** Indicates the reason for a credit to the cardholder. */
                    class CreditReasonIndicator
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** No credit */
                            @JvmField val NO_CREDIT = of("no_credit")

                            /** Passenger transport ancillary purchase cancellation */
                            @JvmField
                            val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION =
                                of("passenger_transport_ancillary_purchase_cancellation")

                            /**
                             * Airline ticket and passenger transport ancillary purchase
                             * cancellation
                             */
                            @JvmField
                            val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION =
                                of(
                                    "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation"
                                )

                            /** Airline ticket cancellation */
                            @JvmField
                            val AIRLINE_TICKET_CANCELLATION = of("airline_ticket_cancellation")

                            /** Other */
                            @JvmField val OTHER = of("other")

                            /** Partial refund of airline ticket */
                            @JvmField
                            val PARTIAL_REFUND_OF_AIRLINE_TICKET =
                                of("partial_refund_of_airline_ticket")

                            @JvmStatic
                            fun of(value: String) = CreditReasonIndicator(JsonField.of(value))
                        }

                        /** An enum containing [CreditReasonIndicator]'s known values. */
                        enum class Known {
                            /** No credit */
                            NO_CREDIT,
                            /** Passenger transport ancillary purchase cancellation */
                            PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION,
                            /**
                             * Airline ticket and passenger transport ancillary purchase
                             * cancellation
                             */
                            AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION,
                            /** Airline ticket cancellation */
                            AIRLINE_TICKET_CANCELLATION,
                            /** Other */
                            OTHER,
                            /** Partial refund of airline ticket */
                            PARTIAL_REFUND_OF_AIRLINE_TICKET,
                        }

                        /**
                         * An enum containing [CreditReasonIndicator]'s known values, as well as an
                         * [_UNKNOWN] member.
                         *
                         * An instance of [CreditReasonIndicator] can contain an unknown value in a
                         * couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** No credit */
                            NO_CREDIT,
                            /** Passenger transport ancillary purchase cancellation */
                            PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION,
                            /**
                             * Airline ticket and passenger transport ancillary purchase
                             * cancellation
                             */
                            AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION,
                            /** Airline ticket cancellation */
                            AIRLINE_TICKET_CANCELLATION,
                            /** Other */
                            OTHER,
                            /** Partial refund of airline ticket */
                            PARTIAL_REFUND_OF_AIRLINE_TICKET,
                            /**
                             * An enum member indicating that [CreditReasonIndicator] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NO_CREDIT -> Value.NO_CREDIT
                                PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION ->
                                    Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION
                                AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION ->
                                    Value
                                        .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION
                                AIRLINE_TICKET_CANCELLATION -> Value.AIRLINE_TICKET_CANCELLATION
                                OTHER -> Value.OTHER
                                PARTIAL_REFUND_OF_AIRLINE_TICKET ->
                                    Value.PARTIAL_REFUND_OF_AIRLINE_TICKET
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NO_CREDIT -> Known.NO_CREDIT
                                PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION ->
                                    Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION
                                AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION ->
                                    Known
                                        .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION
                                AIRLINE_TICKET_CANCELLATION -> Known.AIRLINE_TICKET_CANCELLATION
                                OTHER -> Known.OTHER
                                PARTIAL_REFUND_OF_AIRLINE_TICKET ->
                                    Known.PARTIAL_REFUND_OF_AIRLINE_TICKET
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown CreditReasonIndicator: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): CreditReasonIndicator = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is CreditReasonIndicator && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /** Indicates whether this ticket is non-refundable. */
                    class RestrictedTicketIndicator
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** No restrictions */
                            @JvmField val NO_RESTRICTIONS = of("no_restrictions")

                            /** Restricted non-refundable ticket */
                            @JvmField
                            val RESTRICTED_NON_REFUNDABLE_TICKET =
                                of("restricted_non_refundable_ticket")

                            @JvmStatic
                            fun of(value: String) = RestrictedTicketIndicator(JsonField.of(value))
                        }

                        /** An enum containing [RestrictedTicketIndicator]'s known values. */
                        enum class Known {
                            /** No restrictions */
                            NO_RESTRICTIONS,
                            /** Restricted non-refundable ticket */
                            RESTRICTED_NON_REFUNDABLE_TICKET,
                        }

                        /**
                         * An enum containing [RestrictedTicketIndicator]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [RestrictedTicketIndicator] can contain an unknown value
                         * in a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** No restrictions */
                            NO_RESTRICTIONS,
                            /** Restricted non-refundable ticket */
                            RESTRICTED_NON_REFUNDABLE_TICKET,
                            /**
                             * An enum member indicating that [RestrictedTicketIndicator] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NO_RESTRICTIONS -> Value.NO_RESTRICTIONS
                                RESTRICTED_NON_REFUNDABLE_TICKET ->
                                    Value.RESTRICTED_NON_REFUNDABLE_TICKET
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NO_RESTRICTIONS -> Known.NO_RESTRICTIONS
                                RESTRICTED_NON_REFUNDABLE_TICKET ->
                                    Known.RESTRICTED_NON_REFUNDABLE_TICKET
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown RestrictedTicketIndicator: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): RestrictedTicketIndicator = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is RestrictedTicketIndicator && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /** Indicates why a ticket was changed. */
                    class TicketChangeIndicator
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** None */
                            @JvmField val NONE = of("none")

                            /** Change to existing ticket */
                            @JvmField
                            val CHANGE_TO_EXISTING_TICKET = of("change_to_existing_ticket")

                            /** New ticket */
                            @JvmField val NEW_TICKET = of("new_ticket")

                            @JvmStatic
                            fun of(value: String) = TicketChangeIndicator(JsonField.of(value))
                        }

                        /** An enum containing [TicketChangeIndicator]'s known values. */
                        enum class Known {
                            /** None */
                            NONE,
                            /** Change to existing ticket */
                            CHANGE_TO_EXISTING_TICKET,
                            /** New ticket */
                            NEW_TICKET,
                        }

                        /**
                         * An enum containing [TicketChangeIndicator]'s known values, as well as an
                         * [_UNKNOWN] member.
                         *
                         * An instance of [TicketChangeIndicator] can contain an unknown value in a
                         * couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** None */
                            NONE,
                            /** Change to existing ticket */
                            CHANGE_TO_EXISTING_TICKET,
                            /** New ticket */
                            NEW_TICKET,
                            /**
                             * An enum member indicating that [TicketChangeIndicator] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NONE -> Value.NONE
                                CHANGE_TO_EXISTING_TICKET -> Value.CHANGE_TO_EXISTING_TICKET
                                NEW_TICKET -> Value.NEW_TICKET
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NONE -> Known.NONE
                                CHANGE_TO_EXISTING_TICKET -> Known.CHANGE_TO_EXISTING_TICKET
                                NEW_TICKET -> Known.NEW_TICKET
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown TicketChangeIndicator: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): TicketChangeIndicator = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is TicketChangeIndicator && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    class TripLeg
                    @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                    private constructor(
                        private val carrierCode: JsonField<String>,
                        private val destinationCityAirportCode: JsonField<String>,
                        private val fareBasisCode: JsonField<String>,
                        private val flightNumber: JsonField<String>,
                        private val serviceClass: JsonField<String>,
                        private val stopOverCode: JsonField<StopOverCode>,
                        private val additionalProperties: MutableMap<String, JsonValue>,
                    ) {

                        @JsonCreator
                        private constructor(
                            @JsonProperty("carrier_code")
                            @ExcludeMissing
                            carrierCode: JsonField<String> = JsonMissing.of(),
                            @JsonProperty("destination_city_airport_code")
                            @ExcludeMissing
                            destinationCityAirportCode: JsonField<String> = JsonMissing.of(),
                            @JsonProperty("fare_basis_code")
                            @ExcludeMissing
                            fareBasisCode: JsonField<String> = JsonMissing.of(),
                            @JsonProperty("flight_number")
                            @ExcludeMissing
                            flightNumber: JsonField<String> = JsonMissing.of(),
                            @JsonProperty("service_class")
                            @ExcludeMissing
                            serviceClass: JsonField<String> = JsonMissing.of(),
                            @JsonProperty("stop_over_code")
                            @ExcludeMissing
                            stopOverCode: JsonField<StopOverCode> = JsonMissing.of(),
                        ) : this(
                            carrierCode,
                            destinationCityAirportCode,
                            fareBasisCode,
                            flightNumber,
                            serviceClass,
                            stopOverCode,
                            mutableMapOf(),
                        )

                        /**
                         * Carrier code (e.g., United Airlines, Jet Blue, etc.).
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun carrierCode(): Optional<String> =
                            carrierCode.getOptional("carrier_code")

                        /**
                         * Code for the destination city or airport.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun destinationCityAirportCode(): Optional<String> =
                            destinationCityAirportCode.getOptional("destination_city_airport_code")

                        /**
                         * Fare basis code.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun fareBasisCode(): Optional<String> =
                            fareBasisCode.getOptional("fare_basis_code")

                        /**
                         * Flight number.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun flightNumber(): Optional<String> =
                            flightNumber.getOptional("flight_number")

                        /**
                         * Service class (e.g., first class, business class, etc.).
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun serviceClass(): Optional<String> =
                            serviceClass.getOptional("service_class")

                        /**
                         * Indicates whether a stopover is allowed on this ticket.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun stopOverCode(): Optional<StopOverCode> =
                            stopOverCode.getOptional("stop_over_code")

                        /**
                         * Returns the raw JSON value of [carrierCode].
                         *
                         * Unlike [carrierCode], this method doesn't throw if the JSON field has an
                         * unexpected type.
                         */
                        @JsonProperty("carrier_code")
                        @ExcludeMissing
                        fun _carrierCode(): JsonField<String> = carrierCode

                        /**
                         * Returns the raw JSON value of [destinationCityAirportCode].
                         *
                         * Unlike [destinationCityAirportCode], this method doesn't throw if the
                         * JSON field has an unexpected type.
                         */
                        @JsonProperty("destination_city_airport_code")
                        @ExcludeMissing
                        fun _destinationCityAirportCode(): JsonField<String> =
                            destinationCityAirportCode

                        /**
                         * Returns the raw JSON value of [fareBasisCode].
                         *
                         * Unlike [fareBasisCode], this method doesn't throw if the JSON field has
                         * an unexpected type.
                         */
                        @JsonProperty("fare_basis_code")
                        @ExcludeMissing
                        fun _fareBasisCode(): JsonField<String> = fareBasisCode

                        /**
                         * Returns the raw JSON value of [flightNumber].
                         *
                         * Unlike [flightNumber], this method doesn't throw if the JSON field has an
                         * unexpected type.
                         */
                        @JsonProperty("flight_number")
                        @ExcludeMissing
                        fun _flightNumber(): JsonField<String> = flightNumber

                        /**
                         * Returns the raw JSON value of [serviceClass].
                         *
                         * Unlike [serviceClass], this method doesn't throw if the JSON field has an
                         * unexpected type.
                         */
                        @JsonProperty("service_class")
                        @ExcludeMissing
                        fun _serviceClass(): JsonField<String> = serviceClass

                        /**
                         * Returns the raw JSON value of [stopOverCode].
                         *
                         * Unlike [stopOverCode], this method doesn't throw if the JSON field has an
                         * unexpected type.
                         */
                        @JsonProperty("stop_over_code")
                        @ExcludeMissing
                        fun _stopOverCode(): JsonField<StopOverCode> = stopOverCode

                        @JsonAnySetter
                        private fun putAdditionalProperty(key: String, value: JsonValue) {
                            additionalProperties.put(key, value)
                        }

                        @JsonAnyGetter
                        @ExcludeMissing
                        fun _additionalProperties(): Map<String, JsonValue> =
                            Collections.unmodifiableMap(additionalProperties)

                        fun toBuilder() = Builder().from(this)

                        companion object {

                            /**
                             * Returns a mutable builder for constructing an instance of [TripLeg].
                             *
                             * The following fields are required:
                             * ```java
                             * .carrierCode()
                             * .destinationCityAirportCode()
                             * .fareBasisCode()
                             * .flightNumber()
                             * .serviceClass()
                             * .stopOverCode()
                             * ```
                             */
                            @JvmStatic fun builder() = Builder()
                        }

                        /** A builder for [TripLeg]. */
                        class Builder internal constructor() {

                            private var carrierCode: JsonField<String>? = null
                            private var destinationCityAirportCode: JsonField<String>? = null
                            private var fareBasisCode: JsonField<String>? = null
                            private var flightNumber: JsonField<String>? = null
                            private var serviceClass: JsonField<String>? = null
                            private var stopOverCode: JsonField<StopOverCode>? = null
                            private var additionalProperties: MutableMap<String, JsonValue> =
                                mutableMapOf()

                            @JvmSynthetic
                            internal fun from(tripLeg: TripLeg) = apply {
                                carrierCode = tripLeg.carrierCode
                                destinationCityAirportCode = tripLeg.destinationCityAirportCode
                                fareBasisCode = tripLeg.fareBasisCode
                                flightNumber = tripLeg.flightNumber
                                serviceClass = tripLeg.serviceClass
                                stopOverCode = tripLeg.stopOverCode
                                additionalProperties = tripLeg.additionalProperties.toMutableMap()
                            }

                            /** Carrier code (e.g., United Airlines, Jet Blue, etc.). */
                            fun carrierCode(carrierCode: String?) =
                                carrierCode(JsonField.ofNullable(carrierCode))

                            /**
                             * Alias for calling [Builder.carrierCode] with
                             * `carrierCode.orElse(null)`.
                             */
                            fun carrierCode(carrierCode: Optional<String>) =
                                carrierCode(carrierCode.getOrNull())

                            /**
                             * Sets [Builder.carrierCode] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.carrierCode] with a well-typed
                             * [String] value instead. This method is primarily for setting the
                             * field to an undocumented or not yet supported value.
                             */
                            fun carrierCode(carrierCode: JsonField<String>) = apply {
                                this.carrierCode = carrierCode
                            }

                            /** Code for the destination city or airport. */
                            fun destinationCityAirportCode(destinationCityAirportCode: String?) =
                                destinationCityAirportCode(
                                    JsonField.ofNullable(destinationCityAirportCode)
                                )

                            /**
                             * Alias for calling [Builder.destinationCityAirportCode] with
                             * `destinationCityAirportCode.orElse(null)`.
                             */
                            fun destinationCityAirportCode(
                                destinationCityAirportCode: Optional<String>
                            ) = destinationCityAirportCode(destinationCityAirportCode.getOrNull())

                            /**
                             * Sets [Builder.destinationCityAirportCode] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.destinationCityAirportCode] with a
                             * well-typed [String] value instead. This method is primarily for
                             * setting the field to an undocumented or not yet supported value.
                             */
                            fun destinationCityAirportCode(
                                destinationCityAirportCode: JsonField<String>
                            ) = apply {
                                this.destinationCityAirportCode = destinationCityAirportCode
                            }

                            /** Fare basis code. */
                            fun fareBasisCode(fareBasisCode: String?) =
                                fareBasisCode(JsonField.ofNullable(fareBasisCode))

                            /**
                             * Alias for calling [Builder.fareBasisCode] with
                             * `fareBasisCode.orElse(null)`.
                             */
                            fun fareBasisCode(fareBasisCode: Optional<String>) =
                                fareBasisCode(fareBasisCode.getOrNull())

                            /**
                             * Sets [Builder.fareBasisCode] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.fareBasisCode] with a well-typed
                             * [String] value instead. This method is primarily for setting the
                             * field to an undocumented or not yet supported value.
                             */
                            fun fareBasisCode(fareBasisCode: JsonField<String>) = apply {
                                this.fareBasisCode = fareBasisCode
                            }

                            /** Flight number. */
                            fun flightNumber(flightNumber: String?) =
                                flightNumber(JsonField.ofNullable(flightNumber))

                            /**
                             * Alias for calling [Builder.flightNumber] with
                             * `flightNumber.orElse(null)`.
                             */
                            fun flightNumber(flightNumber: Optional<String>) =
                                flightNumber(flightNumber.getOrNull())

                            /**
                             * Sets [Builder.flightNumber] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.flightNumber] with a well-typed
                             * [String] value instead. This method is primarily for setting the
                             * field to an undocumented or not yet supported value.
                             */
                            fun flightNumber(flightNumber: JsonField<String>) = apply {
                                this.flightNumber = flightNumber
                            }

                            /** Service class (e.g., first class, business class, etc.). */
                            fun serviceClass(serviceClass: String?) =
                                serviceClass(JsonField.ofNullable(serviceClass))

                            /**
                             * Alias for calling [Builder.serviceClass] with
                             * `serviceClass.orElse(null)`.
                             */
                            fun serviceClass(serviceClass: Optional<String>) =
                                serviceClass(serviceClass.getOrNull())

                            /**
                             * Sets [Builder.serviceClass] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.serviceClass] with a well-typed
                             * [String] value instead. This method is primarily for setting the
                             * field to an undocumented or not yet supported value.
                             */
                            fun serviceClass(serviceClass: JsonField<String>) = apply {
                                this.serviceClass = serviceClass
                            }

                            /** Indicates whether a stopover is allowed on this ticket. */
                            fun stopOverCode(stopOverCode: StopOverCode?) =
                                stopOverCode(JsonField.ofNullable(stopOverCode))

                            /**
                             * Alias for calling [Builder.stopOverCode] with
                             * `stopOverCode.orElse(null)`.
                             */
                            fun stopOverCode(stopOverCode: Optional<StopOverCode>) =
                                stopOverCode(stopOverCode.getOrNull())

                            /**
                             * Sets [Builder.stopOverCode] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.stopOverCode] with a well-typed
                             * [StopOverCode] value instead. This method is primarily for setting
                             * the field to an undocumented or not yet supported value.
                             */
                            fun stopOverCode(stopOverCode: JsonField<StopOverCode>) = apply {
                                this.stopOverCode = stopOverCode
                            }

                            fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                                apply {
                                    this.additionalProperties.clear()
                                    putAllAdditionalProperties(additionalProperties)
                                }

                            fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                                additionalProperties.put(key, value)
                            }

                            fun putAllAdditionalProperties(
                                additionalProperties: Map<String, JsonValue>
                            ) = apply { this.additionalProperties.putAll(additionalProperties) }

                            fun removeAdditionalProperty(key: String) = apply {
                                additionalProperties.remove(key)
                            }

                            fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                                keys.forEach(::removeAdditionalProperty)
                            }

                            /**
                             * Returns an immutable instance of [TripLeg].
                             *
                             * Further updates to this [Builder] will not mutate the returned
                             * instance.
                             *
                             * The following fields are required:
                             * ```java
                             * .carrierCode()
                             * .destinationCityAirportCode()
                             * .fareBasisCode()
                             * .flightNumber()
                             * .serviceClass()
                             * .stopOverCode()
                             * ```
                             *
                             * @throws IllegalStateException if any required field is unset.
                             */
                            fun build(): TripLeg =
                                TripLeg(
                                    checkRequired("carrierCode", carrierCode),
                                    checkRequired(
                                        "destinationCityAirportCode",
                                        destinationCityAirportCode,
                                    ),
                                    checkRequired("fareBasisCode", fareBasisCode),
                                    checkRequired("flightNumber", flightNumber),
                                    checkRequired("serviceClass", serviceClass),
                                    checkRequired("stopOverCode", stopOverCode),
                                    additionalProperties.toMutableMap(),
                                )
                        }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): TripLeg = apply {
                            if (validated) {
                                return@apply
                            }

                            carrierCode()
                            destinationCityAirportCode()
                            fareBasisCode()
                            flightNumber()
                            serviceClass()
                            stopOverCode().ifPresent { it.validate() }
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int =
                            (if (carrierCode.asKnown().isPresent) 1 else 0) +
                                (if (destinationCityAirportCode.asKnown().isPresent) 1 else 0) +
                                (if (fareBasisCode.asKnown().isPresent) 1 else 0) +
                                (if (flightNumber.asKnown().isPresent) 1 else 0) +
                                (if (serviceClass.asKnown().isPresent) 1 else 0) +
                                (stopOverCode.asKnown().getOrNull()?.validity() ?: 0)

                        /** Indicates whether a stopover is allowed on this ticket. */
                        class StopOverCode
                        @JsonCreator
                        private constructor(private val value: JsonField<String>) : Enum {

                            /**
                             * Returns this class instance's raw value.
                             *
                             * This is usually only useful if this instance was deserialized from
                             * data that doesn't match any known member, and you want to know that
                             * value. For example, if the SDK is on an older version than the API,
                             * then the API may respond with new members that the SDK is unaware of.
                             */
                            @com.fasterxml.jackson.annotation.JsonValue
                            fun _value(): JsonField<String> = value

                            companion object {

                                /** None */
                                @JvmField val NONE = of("none")

                                /** Stop over allowed */
                                @JvmField val STOP_OVER_ALLOWED = of("stop_over_allowed")

                                /** Stop over not allowed */
                                @JvmField val STOP_OVER_NOT_ALLOWED = of("stop_over_not_allowed")

                                @JvmStatic fun of(value: String) = StopOverCode(JsonField.of(value))
                            }

                            /** An enum containing [StopOverCode]'s known values. */
                            enum class Known {
                                /** None */
                                NONE,
                                /** Stop over allowed */
                                STOP_OVER_ALLOWED,
                                /** Stop over not allowed */
                                STOP_OVER_NOT_ALLOWED,
                            }

                            /**
                             * An enum containing [StopOverCode]'s known values, as well as an
                             * [_UNKNOWN] member.
                             *
                             * An instance of [StopOverCode] can contain an unknown value in a
                             * couple of cases:
                             * - It was deserialized from data that doesn't match any known member.
                             *   For example, if the SDK is on an older version than the API, then
                             *   the API may respond with new members that the SDK is unaware of.
                             * - It was constructed with an arbitrary value using the [of] method.
                             */
                            enum class Value {
                                /** None */
                                NONE,
                                /** Stop over allowed */
                                STOP_OVER_ALLOWED,
                                /** Stop over not allowed */
                                STOP_OVER_NOT_ALLOWED,
                                /**
                                 * An enum member indicating that [StopOverCode] was instantiated
                                 * with an unknown value.
                                 */
                                _UNKNOWN,
                            }

                            /**
                             * Returns an enum member corresponding to this class instance's value,
                             * or [Value._UNKNOWN] if the class was instantiated with an unknown
                             * value.
                             *
                             * Use the [known] method instead if you're certain the value is always
                             * known or if you want to throw for the unknown case.
                             */
                            fun value(): Value =
                                when (this) {
                                    NONE -> Value.NONE
                                    STOP_OVER_ALLOWED -> Value.STOP_OVER_ALLOWED
                                    STOP_OVER_NOT_ALLOWED -> Value.STOP_OVER_NOT_ALLOWED
                                    else -> Value._UNKNOWN
                                }

                            /**
                             * Returns an enum member corresponding to this class instance's value.
                             *
                             * Use the [value] method instead if you're uncertain the value is
                             * always known and don't want to throw for the unknown case.
                             *
                             * @throws IncreaseInvalidDataException if this class instance's value
                             *   is a not a known member.
                             */
                            fun known(): Known =
                                when (this) {
                                    NONE -> Known.NONE
                                    STOP_OVER_ALLOWED -> Known.STOP_OVER_ALLOWED
                                    STOP_OVER_NOT_ALLOWED -> Known.STOP_OVER_NOT_ALLOWED
                                    else ->
                                        throw IncreaseInvalidDataException(
                                            "Unknown StopOverCode: $value"
                                        )
                                }

                            /**
                             * Returns this class instance's primitive wire representation.
                             *
                             * This differs from the [toString] method because that method is
                             * primarily for debugging and generally doesn't throw.
                             *
                             * @throws IncreaseInvalidDataException if this class instance's value
                             *   does not have the expected primitive type.
                             */
                            fun asString(): String =
                                _value().asString().orElseThrow {
                                    IncreaseInvalidDataException("Value is not a String")
                                }

                            private var validated: Boolean = false

                            /**
                             * Validates that the types of all values in this object match their
                             * expected types recursively.
                             *
                             * This method is _not_ forwards compatible with new types from the API
                             * for existing fields.
                             *
                             * @throws IncreaseInvalidDataException if any value type in this object
                             *   doesn't match its expected type.
                             */
                            fun validate(): StopOverCode = apply {
                                if (validated) {
                                    return@apply
                                }

                                known()
                                validated = true
                            }

                            fun isValid(): Boolean =
                                try {
                                    validate()
                                    true
                                } catch (e: IncreaseInvalidDataException) {
                                    false
                                }

                            /**
                             * Returns a score indicating how many valid values are contained in
                             * this object recursively.
                             *
                             * Used for best match union deserialization.
                             */
                            @JvmSynthetic
                            internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                            override fun equals(other: Any?): Boolean {
                                if (this === other) {
                                    return true
                                }

                                return other is StopOverCode && value == other.value
                            }

                            override fun hashCode() = value.hashCode()

                            override fun toString() = value.toString()
                        }

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is TripLeg &&
                                carrierCode == other.carrierCode &&
                                destinationCityAirportCode == other.destinationCityAirportCode &&
                                fareBasisCode == other.fareBasisCode &&
                                flightNumber == other.flightNumber &&
                                serviceClass == other.serviceClass &&
                                stopOverCode == other.stopOverCode &&
                                additionalProperties == other.additionalProperties
                        }

                        private val hashCode: Int by lazy {
                            Objects.hash(
                                carrierCode,
                                destinationCityAirportCode,
                                fareBasisCode,
                                flightNumber,
                                serviceClass,
                                stopOverCode,
                                additionalProperties,
                            )
                        }

                        override fun hashCode(): Int = hashCode

                        override fun toString() =
                            "TripLeg{carrierCode=$carrierCode, destinationCityAirportCode=$destinationCityAirportCode, fareBasisCode=$fareBasisCode, flightNumber=$flightNumber, serviceClass=$serviceClass, stopOverCode=$stopOverCode, additionalProperties=$additionalProperties}"
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Travel &&
                            ancillary == other.ancillary &&
                            computerizedReservationSystem == other.computerizedReservationSystem &&
                            creditReasonIndicator == other.creditReasonIndicator &&
                            departureDate == other.departureDate &&
                            originationCityAirportCode == other.originationCityAirportCode &&
                            passengerName == other.passengerName &&
                            restrictedTicketIndicator == other.restrictedTicketIndicator &&
                            ticketChangeIndicator == other.ticketChangeIndicator &&
                            ticketNumber == other.ticketNumber &&
                            travelAgencyCode == other.travelAgencyCode &&
                            travelAgencyName == other.travelAgencyName &&
                            tripLegs == other.tripLegs &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            ancillary,
                            computerizedReservationSystem,
                            creditReasonIndicator,
                            departureDate,
                            originationCityAirportCode,
                            passengerName,
                            restrictedTicketIndicator,
                            ticketChangeIndicator,
                            ticketNumber,
                            travelAgencyCode,
                            travelAgencyName,
                            tripLegs,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Travel{ancillary=$ancillary, computerizedReservationSystem=$computerizedReservationSystem, creditReasonIndicator=$creditReasonIndicator, departureDate=$departureDate, originationCityAirportCode=$originationCityAirportCode, passengerName=$passengerName, restrictedTicketIndicator=$restrictedTicketIndicator, ticketChangeIndicator=$ticketChangeIndicator, ticketNumber=$ticketNumber, travelAgencyCode=$travelAgencyCode, travelAgencyName=$travelAgencyName, tripLegs=$tripLegs, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is PurchaseDetails &&
                        carRental == other.carRental &&
                        customerReferenceIdentifier == other.customerReferenceIdentifier &&
                        localTaxAmount == other.localTaxAmount &&
                        localTaxCurrency == other.localTaxCurrency &&
                        lodging == other.lodging &&
                        nationalTaxAmount == other.nationalTaxAmount &&
                        nationalTaxCurrency == other.nationalTaxCurrency &&
                        purchaseIdentifier == other.purchaseIdentifier &&
                        purchaseIdentifierFormat == other.purchaseIdentifierFormat &&
                        travel == other.travel &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        carRental,
                        customerReferenceIdentifier,
                        localTaxAmount,
                        localTaxCurrency,
                        lodging,
                        nationalTaxAmount,
                        nationalTaxCurrency,
                        purchaseIdentifier,
                        purchaseIdentifierFormat,
                        travel,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "PurchaseDetails{carRental=$carRental, customerReferenceIdentifier=$customerReferenceIdentifier, localTaxAmount=$localTaxAmount, localTaxCurrency=$localTaxCurrency, lodging=$lodging, nationalTaxAmount=$nationalTaxAmount, nationalTaxCurrency=$nationalTaxCurrency, purchaseIdentifier=$purchaseIdentifier, purchaseIdentifierFormat=$purchaseIdentifierFormat, travel=$travel, additionalProperties=$additionalProperties}"
            }

            class SchemeFee
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val amount: JsonField<String>,
                private val createdAt: JsonField<OffsetDateTime>,
                private val currency: JsonField<Currency>,
                private val feeType: JsonField<FeeType>,
                private val fixedComponent: JsonField<String>,
                private val variableRate: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("amount")
                    @ExcludeMissing
                    amount: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("created_at")
                    @ExcludeMissing
                    createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                    @JsonProperty("currency")
                    @ExcludeMissing
                    currency: JsonField<Currency> = JsonMissing.of(),
                    @JsonProperty("fee_type")
                    @ExcludeMissing
                    feeType: JsonField<FeeType> = JsonMissing.of(),
                    @JsonProperty("fixed_component")
                    @ExcludeMissing
                    fixedComponent: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("variable_rate")
                    @ExcludeMissing
                    variableRate: JsonField<String> = JsonMissing.of(),
                ) : this(
                    amount,
                    createdAt,
                    currency,
                    feeType,
                    fixedComponent,
                    variableRate,
                    mutableMapOf(),
                )

                /**
                 * The fee amount given as a string containing a decimal number.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun amount(): String = amount.getRequired("amount")

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was
                 * created.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /**
                 * The type of fee being assessed.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun feeType(): FeeType = feeType.getRequired("fee_type")

                /**
                 * The fixed component of the fee, if applicable, given in major units of the fee
                 * amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun fixedComponent(): Optional<String> =
                    fixedComponent.getOptional("fixed_component")

                /**
                 * The variable rate component of the fee, if applicable, given as a decimal (e.g.,
                 * 0.015 for 1.5%).
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun variableRate(): Optional<String> = variableRate.getOptional("variable_rate")

                /**
                 * Returns the raw JSON value of [amount].
                 *
                 * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<String> = amount

                /**
                 * Returns the raw JSON value of [createdAt].
                 *
                 * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("created_at")
                @ExcludeMissing
                fun _createdAt(): JsonField<OffsetDateTime> = createdAt

                /**
                 * Returns the raw JSON value of [currency].
                 *
                 * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun _currency(): JsonField<Currency> = currency

                /**
                 * Returns the raw JSON value of [feeType].
                 *
                 * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("fee_type")
                @ExcludeMissing
                fun _feeType(): JsonField<FeeType> = feeType

                /**
                 * Returns the raw JSON value of [fixedComponent].
                 *
                 * Unlike [fixedComponent], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("fixed_component")
                @ExcludeMissing
                fun _fixedComponent(): JsonField<String> = fixedComponent

                /**
                 * Returns the raw JSON value of [variableRate].
                 *
                 * Unlike [variableRate], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("variable_rate")
                @ExcludeMissing
                fun _variableRate(): JsonField<String> = variableRate

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [SchemeFee].
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [SchemeFee]. */
                class Builder internal constructor() {

                    private var amount: JsonField<String>? = null
                    private var createdAt: JsonField<OffsetDateTime>? = null
                    private var currency: JsonField<Currency>? = null
                    private var feeType: JsonField<FeeType>? = null
                    private var fixedComponent: JsonField<String>? = null
                    private var variableRate: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(schemeFee: SchemeFee) = apply {
                        amount = schemeFee.amount
                        createdAt = schemeFee.createdAt
                        currency = schemeFee.currency
                        feeType = schemeFee.feeType
                        fixedComponent = schemeFee.fixedComponent
                        variableRate = schemeFee.variableRate
                        additionalProperties = schemeFee.additionalProperties.toMutableMap()
                    }

                    /** The fee amount given as a string containing a decimal number. */
                    fun amount(amount: String) = amount(JsonField.of(amount))

                    /**
                     * Sets [Builder.amount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.amount] with a well-typed [String] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun amount(amount: JsonField<String>) = apply { this.amount = amount }

                    /**
                     * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee
                     * was created.
                     */
                    fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt))

                    /**
                     * Sets [Builder.createdAt] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.createdAt] with a well-typed
                     * [OffsetDateTime] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply {
                        this.createdAt = createdAt
                    }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                     * reimbursement.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * Sets [Builder.currency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.currency] with a well-typed [Currency] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                    /** The type of fee being assessed. */
                    fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType))

                    /**
                     * Sets [Builder.feeType] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.feeType] with a well-typed [FeeType] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun feeType(feeType: JsonField<FeeType>) = apply { this.feeType = feeType }

                    /**
                     * The fixed component of the fee, if applicable, given in major units of the
                     * fee amount.
                     */
                    fun fixedComponent(fixedComponent: String?) =
                        fixedComponent(JsonField.ofNullable(fixedComponent))

                    /**
                     * Alias for calling [Builder.fixedComponent] with
                     * `fixedComponent.orElse(null)`.
                     */
                    fun fixedComponent(fixedComponent: Optional<String>) =
                        fixedComponent(fixedComponent.getOrNull())

                    /**
                     * Sets [Builder.fixedComponent] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.fixedComponent] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun fixedComponent(fixedComponent: JsonField<String>) = apply {
                        this.fixedComponent = fixedComponent
                    }

                    /**
                     * The variable rate component of the fee, if applicable, given as a decimal
                     * (e.g., 0.015 for 1.5%).
                     */
                    fun variableRate(variableRate: String?) =
                        variableRate(JsonField.ofNullable(variableRate))

                    /**
                     * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`.
                     */
                    fun variableRate(variableRate: Optional<String>) =
                        variableRate(variableRate.getOrNull())

                    /**
                     * Sets [Builder.variableRate] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.variableRate] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun variableRate(variableRate: JsonField<String>) = apply {
                        this.variableRate = variableRate
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [SchemeFee].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): SchemeFee =
                        SchemeFee(
                            checkRequired("amount", amount),
                            checkRequired("createdAt", createdAt),
                            checkRequired("currency", currency),
                            checkRequired("feeType", feeType),
                            checkRequired("fixedComponent", fixedComponent),
                            checkRequired("variableRate", variableRate),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): SchemeFee = apply {
                    if (validated) {
                        return@apply
                    }

                    amount()
                    createdAt()
                    currency().validate()
                    feeType().validate()
                    fixedComponent()
                    variableRate()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (amount.asKnown().isPresent) 1 else 0) +
                        (if (createdAt.asKnown().isPresent) 1 else 0) +
                        (currency.asKnown().getOrNull()?.validity() ?: 0) +
                        (feeType.asKnown().getOrNull()?.validity() ?: 0) +
                        (if (fixedComponent.asKnown().isPresent) 1 else 0) +
                        (if (variableRate.asKnown().isPresent) 1 else 0)

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 */
                class Currency
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** US Dollar (USD) */
                        @JvmField val USD = of("USD")

                        @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                    }

                    /** An enum containing [Currency]'s known values. */
                    enum class Known {
                        /** US Dollar (USD) */
                        USD
                    }

                    /**
                     * An enum containing [Currency]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Currency] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** US Dollar (USD) */
                        USD,
                        /**
                         * An enum member indicating that [Currency] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            USD -> Value.USD
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            USD -> Known.USD
                            else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Currency = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Currency && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** The type of fee being assessed. */
                class FeeType
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY =
                            of("visa_international_service_assessment_single_currency")

                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY =
                            of("visa_international_service_assessment_cross_currency")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE =
                            of("visa_authorization_domestic_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_international_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE =
                            of("visa_authorization_canada_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_international_point_of_sale")

                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE =
                            of("visa_authorization_address_verification_service")

                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        @JvmField
                        val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization")

                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission")

                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_DOMESTIC =
                            of("visa_account_verification_domestic")

                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL =
                            of("visa_account_verification_international")

                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_CANADA =
                            of("visa_account_verification_canada")

                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee")

                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        @JvmField
                        val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE =
                            of("visa_consumer_debit_acceptance_fee")

                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        @JvmField
                        val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE =
                            of("visa_business_debit_acceptance_fee")

                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee")

                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic")

                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        @JvmField
                        val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international")

                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token")

                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token")

                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission")

                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization")

                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        @JvmField
                        val VISA_DIRECT_TRANSACTION_DOMESTIC =
                            of("visa_direct_transaction_domestic")

                        /** Issuer card service fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit")

                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT =
                            of("visa_advertising_service_commercial_credit")

                        /** Issuer Community Growth Acceleration Program Fee. */
                        @JvmField
                        val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM =
                            of("visa_community_growth_acceleration_program")

                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        @JvmField
                        val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT =
                            of("visa_processing_guarantee_commercial_credit")

                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee")

                        @JvmStatic fun of(value: String) = FeeType(JsonField.of(value))
                    }

                    /** An enum containing [FeeType]'s known values. */
                    enum class Known {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                    }

                    /**
                     * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member.
                     *
                     * An instance of [FeeType] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                        /**
                         * An enum member indicating that [FeeType] was instantiated with an unknown
                         * value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Value.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Value.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Known.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Known.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE
                            else -> throw IncreaseInvalidDataException("Unknown FeeType: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): FeeType = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is FeeType && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is SchemeFee &&
                        amount == other.amount &&
                        createdAt == other.createdAt &&
                        currency == other.currency &&
                        feeType == other.feeType &&
                        fixedComponent == other.fixedComponent &&
                        variableRate == other.variableRate &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        amount,
                        createdAt,
                        currency,
                        feeType,
                        fixedComponent,
                        variableRate,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}"
            }

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_refund`.
             */
            class Type @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    @JvmField val CARD_REFUND = of("card_refund")

                    @JvmStatic fun of(value: String) = Type(JsonField.of(value))
                }

                /** An enum containing [Type]'s known values. */
                enum class Known {
                    CARD_REFUND
                }

                /**
                 * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Type] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    CARD_REFUND,
                    /**
                     * An enum member indicating that [Type] was instantiated with an unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        CARD_REFUND -> Value.CARD_REFUND
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        CARD_REFUND -> Known.CARD_REFUND
                        else -> throw IncreaseInvalidDataException("Unknown Type: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Type = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Type && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            override fun equals(other: Any?): Boolean {
                if (this === other) {
                    return true
                }

                return other is CardRefund &&
                    id == other.id &&
                    amount == other.amount &&
                    cardPaymentId == other.cardPaymentId &&
                    cashback == other.cashback &&
                    currency == other.currency &&
                    interchange == other.interchange &&
                    merchantAcceptorId == other.merchantAcceptorId &&
                    merchantCategoryCode == other.merchantCategoryCode &&
                    merchantCity == other.merchantCity &&
                    merchantCountry == other.merchantCountry &&
                    merchantName == other.merchantName &&
                    merchantPostalCode == other.merchantPostalCode &&
                    merchantState == other.merchantState &&
                    networkIdentifiers == other.networkIdentifiers &&
                    presentmentAmount == other.presentmentAmount &&
                    presentmentCurrency == other.presentmentCurrency &&
                    purchaseDetails == other.purchaseDetails &&
                    schemeFees == other.schemeFees &&
                    transactionId == other.transactionId &&
                    type == other.type &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    id,
                    amount,
                    cardPaymentId,
                    cashback,
                    currency,
                    interchange,
                    merchantAcceptorId,
                    merchantCategoryCode,
                    merchantCity,
                    merchantCountry,
                    merchantName,
                    merchantPostalCode,
                    merchantState,
                    networkIdentifiers,
                    presentmentAmount,
                    presentmentCurrency,
                    purchaseDetails,
                    schemeFees,
                    transactionId,
                    type,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardRefund{id=$id, amount=$amount, cardPaymentId=$cardPaymentId, cashback=$cashback, currency=$currency, interchange=$interchange, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantName=$merchantName, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkIdentifiers=$networkIdentifiers, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, purchaseDetails=$purchaseDetails, schemeFees=$schemeFees, transactionId=$transactionId, type=$type, additionalProperties=$additionalProperties}"
        }

        /**
         * A Card Reversal object. This field will be present in the JSON response if and only if
         * `category` is equal to `card_reversal`. Card Reversals cancel parts of or the entirety of
         * an existing Card Authorization.
         */
        class CardReversal
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val id: JsonField<String>,
            private val cardAuthorizationId: JsonField<String>,
            private val currency: JsonField<Currency>,
            private val merchantAcceptorId: JsonField<String>,
            private val merchantCategoryCode: JsonField<String>,
            private val merchantCity: JsonField<String>,
            private val merchantCountry: JsonField<String>,
            private val merchantDescriptor: JsonField<String>,
            private val merchantPostalCode: JsonField<String>,
            private val merchantState: JsonField<String>,
            private val network: JsonField<Network>,
            private val networkIdentifiers: JsonField<NetworkIdentifiers>,
            private val pendingTransactionId: JsonField<String>,
            private val presentmentCurrency: JsonField<String>,
            private val reversalAmount: JsonField<Long>,
            private val reversalPresentmentAmount: JsonField<Long>,
            private val reversalReason: JsonField<ReversalReason>,
            private val schemeFees: JsonField<List<SchemeFee>>,
            private val terminalId: JsonField<String>,
            private val type: JsonField<Type>,
            private val updatedAuthorizationAmount: JsonField<Long>,
            private val updatedAuthorizationPresentmentAmount: JsonField<Long>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
                @JsonProperty("card_authorization_id")
                @ExcludeMissing
                cardAuthorizationId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("merchant_acceptor_id")
                @ExcludeMissing
                merchantAcceptorId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_category_code")
                @ExcludeMissing
                merchantCategoryCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_city")
                @ExcludeMissing
                merchantCity: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_country")
                @ExcludeMissing
                merchantCountry: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_descriptor")
                @ExcludeMissing
                merchantDescriptor: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_postal_code")
                @ExcludeMissing
                merchantPostalCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_state")
                @ExcludeMissing
                merchantState: JsonField<String> = JsonMissing.of(),
                @JsonProperty("network")
                @ExcludeMissing
                network: JsonField<Network> = JsonMissing.of(),
                @JsonProperty("network_identifiers")
                @ExcludeMissing
                networkIdentifiers: JsonField<NetworkIdentifiers> = JsonMissing.of(),
                @JsonProperty("pending_transaction_id")
                @ExcludeMissing
                pendingTransactionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("presentment_currency")
                @ExcludeMissing
                presentmentCurrency: JsonField<String> = JsonMissing.of(),
                @JsonProperty("reversal_amount")
                @ExcludeMissing
                reversalAmount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("reversal_presentment_amount")
                @ExcludeMissing
                reversalPresentmentAmount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("reversal_reason")
                @ExcludeMissing
                reversalReason: JsonField<ReversalReason> = JsonMissing.of(),
                @JsonProperty("scheme_fees")
                @ExcludeMissing
                schemeFees: JsonField<List<SchemeFee>> = JsonMissing.of(),
                @JsonProperty("terminal_id")
                @ExcludeMissing
                terminalId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
                @JsonProperty("updated_authorization_amount")
                @ExcludeMissing
                updatedAuthorizationAmount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("updated_authorization_presentment_amount")
                @ExcludeMissing
                updatedAuthorizationPresentmentAmount: JsonField<Long> = JsonMissing.of(),
            ) : this(
                id,
                cardAuthorizationId,
                currency,
                merchantAcceptorId,
                merchantCategoryCode,
                merchantCity,
                merchantCountry,
                merchantDescriptor,
                merchantPostalCode,
                merchantState,
                network,
                networkIdentifiers,
                pendingTransactionId,
                presentmentCurrency,
                reversalAmount,
                reversalPresentmentAmount,
                reversalReason,
                schemeFees,
                terminalId,
                type,
                updatedAuthorizationAmount,
                updatedAuthorizationPresentmentAmount,
                mutableMapOf(),
            )

            /**
             * The Card Reversal identifier.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun id(): String = id.getRequired("id")

            /**
             * The identifier for the Card Authorization this reverses.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun cardAuthorizationId(): String =
                cardAuthorizationId.getRequired("card_authorization_id")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's
             * currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun currency(): Currency = currency.getRequired("currency")

            /**
             * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantAcceptorId(): String =
                merchantAcceptorId.getRequired("merchant_acceptor_id")

            /**
             * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCategoryCode(): String =
                merchantCategoryCode.getRequired("merchant_category_code")

            /**
             * The city the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantCity(): Optional<String> = merchantCity.getOptional("merchant_city")

            /**
             * The country the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantCountry(): Optional<String> =
                merchantCountry.getOptional("merchant_country")

            /**
             * The merchant descriptor of the merchant the card is transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantDescriptor(): String = merchantDescriptor.getRequired("merchant_descriptor")

            /**
             * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit ZIP
             * code, where the first 5 and last 4 are separated by a dash.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantPostalCode(): Optional<String> =
                merchantPostalCode.getOptional("merchant_postal_code")

            /**
             * The state the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantState(): Optional<String> = merchantState.getOptional("merchant_state")

            /**
             * The card network used to process this card authorization.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun network(): Network = network.getRequired("network")

            /**
             * Network-specific identifiers for a specific request or transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun networkIdentifiers(): NetworkIdentifiers =
                networkIdentifiers.getRequired("network_identifiers")

            /**
             * The identifier of the Pending Transaction associated with this Card Reversal.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun pendingTransactionId(): Optional<String> =
                pendingTransactionId.getOptional("pending_transaction_id")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's
             * presentment currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun presentmentCurrency(): String =
                presentmentCurrency.getRequired("presentment_currency")

            /**
             * The amount of this reversal in the minor unit of the transaction's currency. For
             * dollars, for example, this is cents.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun reversalAmount(): Long = reversalAmount.getRequired("reversal_amount")

            /**
             * The amount of this reversal in the minor unit of the transaction's presentment
             * currency. For dollars, for example, this is cents.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun reversalPresentmentAmount(): Long =
                reversalPresentmentAmount.getRequired("reversal_presentment_amount")

            /**
             * Why this reversal was initiated.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun reversalReason(): Optional<ReversalReason> =
                reversalReason.getOptional("reversal_reason")

            /**
             * The scheme fees associated with this card reversal.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun schemeFees(): List<SchemeFee> = schemeFees.getRequired("scheme_fees")

            /**
             * The terminal identifier (commonly abbreviated as TID) of the terminal the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun terminalId(): Optional<String> = terminalId.getOptional("terminal_id")

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_reversal`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun type(): Type = type.getRequired("type")

            /**
             * The amount left pending on the Card Authorization in the minor unit of the
             * transaction's currency. For dollars, for example, this is cents.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun updatedAuthorizationAmount(): Long =
                updatedAuthorizationAmount.getRequired("updated_authorization_amount")

            /**
             * The amount left pending on the Card Authorization in the minor unit of the
             * transaction's presentment currency. For dollars, for example, this is cents.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun updatedAuthorizationPresentmentAmount(): Long =
                updatedAuthorizationPresentmentAmount.getRequired(
                    "updated_authorization_presentment_amount"
                )

            /**
             * Returns the raw JSON value of [id].
             *
             * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id

            /**
             * Returns the raw JSON value of [cardAuthorizationId].
             *
             * Unlike [cardAuthorizationId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("card_authorization_id")
            @ExcludeMissing
            fun _cardAuthorizationId(): JsonField<String> = cardAuthorizationId

            /**
             * Returns the raw JSON value of [currency].
             *
             * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("currency")
            @ExcludeMissing
            fun _currency(): JsonField<Currency> = currency

            /**
             * Returns the raw JSON value of [merchantAcceptorId].
             *
             * Unlike [merchantAcceptorId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_acceptor_id")
            @ExcludeMissing
            fun _merchantAcceptorId(): JsonField<String> = merchantAcceptorId

            /**
             * Returns the raw JSON value of [merchantCategoryCode].
             *
             * Unlike [merchantCategoryCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_category_code")
            @ExcludeMissing
            fun _merchantCategoryCode(): JsonField<String> = merchantCategoryCode

            /**
             * Returns the raw JSON value of [merchantCity].
             *
             * Unlike [merchantCity], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_city")
            @ExcludeMissing
            fun _merchantCity(): JsonField<String> = merchantCity

            /**
             * Returns the raw JSON value of [merchantCountry].
             *
             * Unlike [merchantCountry], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_country")
            @ExcludeMissing
            fun _merchantCountry(): JsonField<String> = merchantCountry

            /**
             * Returns the raw JSON value of [merchantDescriptor].
             *
             * Unlike [merchantDescriptor], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_descriptor")
            @ExcludeMissing
            fun _merchantDescriptor(): JsonField<String> = merchantDescriptor

            /**
             * Returns the raw JSON value of [merchantPostalCode].
             *
             * Unlike [merchantPostalCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_postal_code")
            @ExcludeMissing
            fun _merchantPostalCode(): JsonField<String> = merchantPostalCode

            /**
             * Returns the raw JSON value of [merchantState].
             *
             * Unlike [merchantState], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_state")
            @ExcludeMissing
            fun _merchantState(): JsonField<String> = merchantState

            /**
             * Returns the raw JSON value of [network].
             *
             * Unlike [network], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("network") @ExcludeMissing fun _network(): JsonField<Network> = network

            /**
             * Returns the raw JSON value of [networkIdentifiers].
             *
             * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_identifiers")
            @ExcludeMissing
            fun _networkIdentifiers(): JsonField<NetworkIdentifiers> = networkIdentifiers

            /**
             * Returns the raw JSON value of [pendingTransactionId].
             *
             * Unlike [pendingTransactionId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("pending_transaction_id")
            @ExcludeMissing
            fun _pendingTransactionId(): JsonField<String> = pendingTransactionId

            /**
             * Returns the raw JSON value of [presentmentCurrency].
             *
             * Unlike [presentmentCurrency], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("presentment_currency")
            @ExcludeMissing
            fun _presentmentCurrency(): JsonField<String> = presentmentCurrency

            /**
             * Returns the raw JSON value of [reversalAmount].
             *
             * Unlike [reversalAmount], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("reversal_amount")
            @ExcludeMissing
            fun _reversalAmount(): JsonField<Long> = reversalAmount

            /**
             * Returns the raw JSON value of [reversalPresentmentAmount].
             *
             * Unlike [reversalPresentmentAmount], this method doesn't throw if the JSON field has
             * an unexpected type.
             */
            @JsonProperty("reversal_presentment_amount")
            @ExcludeMissing
            fun _reversalPresentmentAmount(): JsonField<Long> = reversalPresentmentAmount

            /**
             * Returns the raw JSON value of [reversalReason].
             *
             * Unlike [reversalReason], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("reversal_reason")
            @ExcludeMissing
            fun _reversalReason(): JsonField<ReversalReason> = reversalReason

            /**
             * Returns the raw JSON value of [schemeFees].
             *
             * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("scheme_fees")
            @ExcludeMissing
            fun _schemeFees(): JsonField<List<SchemeFee>> = schemeFees

            /**
             * Returns the raw JSON value of [terminalId].
             *
             * Unlike [terminalId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("terminal_id")
            @ExcludeMissing
            fun _terminalId(): JsonField<String> = terminalId

            /**
             * Returns the raw JSON value of [type].
             *
             * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("type") @ExcludeMissing fun _type(): JsonField<Type> = type

            /**
             * Returns the raw JSON value of [updatedAuthorizationAmount].
             *
             * Unlike [updatedAuthorizationAmount], this method doesn't throw if the JSON field has
             * an unexpected type.
             */
            @JsonProperty("updated_authorization_amount")
            @ExcludeMissing
            fun _updatedAuthorizationAmount(): JsonField<Long> = updatedAuthorizationAmount

            /**
             * Returns the raw JSON value of [updatedAuthorizationPresentmentAmount].
             *
             * Unlike [updatedAuthorizationPresentmentAmount], this method doesn't throw if the JSON
             * field has an unexpected type.
             */
            @JsonProperty("updated_authorization_presentment_amount")
            @ExcludeMissing
            fun _updatedAuthorizationPresentmentAmount(): JsonField<Long> =
                updatedAuthorizationPresentmentAmount

            @JsonAnySetter
            private fun putAdditionalProperty(key: String, value: JsonValue) {
                additionalProperties.put(key, value)
            }

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map<String, JsonValue> =
                Collections.unmodifiableMap(additionalProperties)

            fun toBuilder() = Builder().from(this)

            companion object {

                /**
                 * Returns a mutable builder for constructing an instance of [CardReversal].
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .cardAuthorizationId()
                 * .currency()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCity()
                 * .merchantCountry()
                 * .merchantDescriptor()
                 * .merchantPostalCode()
                 * .merchantState()
                 * .network()
                 * .networkIdentifiers()
                 * .pendingTransactionId()
                 * .presentmentCurrency()
                 * .reversalAmount()
                 * .reversalPresentmentAmount()
                 * .reversalReason()
                 * .schemeFees()
                 * .terminalId()
                 * .type()
                 * .updatedAuthorizationAmount()
                 * .updatedAuthorizationPresentmentAmount()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

            /** A builder for [CardReversal]. */
            class Builder internal constructor() {

                private var id: JsonField<String>? = null
                private var cardAuthorizationId: JsonField<String>? = null
                private var currency: JsonField<Currency>? = null
                private var merchantAcceptorId: JsonField<String>? = null
                private var merchantCategoryCode: JsonField<String>? = null
                private var merchantCity: JsonField<String>? = null
                private var merchantCountry: JsonField<String>? = null
                private var merchantDescriptor: JsonField<String>? = null
                private var merchantPostalCode: JsonField<String>? = null
                private var merchantState: JsonField<String>? = null
                private var network: JsonField<Network>? = null
                private var networkIdentifiers: JsonField<NetworkIdentifiers>? = null
                private var pendingTransactionId: JsonField<String>? = null
                private var presentmentCurrency: JsonField<String>? = null
                private var reversalAmount: JsonField<Long>? = null
                private var reversalPresentmentAmount: JsonField<Long>? = null
                private var reversalReason: JsonField<ReversalReason>? = null
                private var schemeFees: JsonField<MutableList<SchemeFee>>? = null
                private var terminalId: JsonField<String>? = null
                private var type: JsonField<Type>? = null
                private var updatedAuthorizationAmount: JsonField<Long>? = null
                private var updatedAuthorizationPresentmentAmount: JsonField<Long>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardReversal: CardReversal) = apply {
                    id = cardReversal.id
                    cardAuthorizationId = cardReversal.cardAuthorizationId
                    currency = cardReversal.currency
                    merchantAcceptorId = cardReversal.merchantAcceptorId
                    merchantCategoryCode = cardReversal.merchantCategoryCode
                    merchantCity = cardReversal.merchantCity
                    merchantCountry = cardReversal.merchantCountry
                    merchantDescriptor = cardReversal.merchantDescriptor
                    merchantPostalCode = cardReversal.merchantPostalCode
                    merchantState = cardReversal.merchantState
                    network = cardReversal.network
                    networkIdentifiers = cardReversal.networkIdentifiers
                    pendingTransactionId = cardReversal.pendingTransactionId
                    presentmentCurrency = cardReversal.presentmentCurrency
                    reversalAmount = cardReversal.reversalAmount
                    reversalPresentmentAmount = cardReversal.reversalPresentmentAmount
                    reversalReason = cardReversal.reversalReason
                    schemeFees = cardReversal.schemeFees.map { it.toMutableList() }
                    terminalId = cardReversal.terminalId
                    type = cardReversal.type
                    updatedAuthorizationAmount = cardReversal.updatedAuthorizationAmount
                    updatedAuthorizationPresentmentAmount =
                        cardReversal.updatedAuthorizationPresentmentAmount
                    additionalProperties = cardReversal.additionalProperties.toMutableMap()
                }

                /** The Card Reversal identifier. */
                fun id(id: String) = id(JsonField.of(id))

                /**
                 * Sets [Builder.id] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.id] with a well-typed [String] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun id(id: JsonField<String>) = apply { this.id = id }

                /** The identifier for the Card Authorization this reverses. */
                fun cardAuthorizationId(cardAuthorizationId: String) =
                    cardAuthorizationId(JsonField.of(cardAuthorizationId))

                /**
                 * Sets [Builder.cardAuthorizationId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cardAuthorizationId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun cardAuthorizationId(cardAuthorizationId: JsonField<String>) = apply {
                    this.cardAuthorizationId = cardAuthorizationId
                }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's
                 * currency.
                 */
                fun currency(currency: Currency) = currency(JsonField.of(currency))

                /**
                 * Sets [Builder.currency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.currency] with a well-typed [Currency] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                /**
                 * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
                 * transacting with.
                 */
                fun merchantAcceptorId(merchantAcceptorId: String) =
                    merchantAcceptorId(JsonField.of(merchantAcceptorId))

                /**
                 * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantAcceptorId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantAcceptorId(merchantAcceptorId: JsonField<String>) = apply {
                    this.merchantAcceptorId = merchantAcceptorId
                }

                /**
                 * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card
                 * is transacting with.
                 */
                fun merchantCategoryCode(merchantCategoryCode: String) =
                    merchantCategoryCode(JsonField.of(merchantCategoryCode))

                /**
                 * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCategoryCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCategoryCode(merchantCategoryCode: JsonField<String>) = apply {
                    this.merchantCategoryCode = merchantCategoryCode
                }

                /** The city the merchant resides in. */
                fun merchantCity(merchantCity: String?) =
                    merchantCity(JsonField.ofNullable(merchantCity))

                /** Alias for calling [Builder.merchantCity] with `merchantCity.orElse(null)`. */
                fun merchantCity(merchantCity: Optional<String>) =
                    merchantCity(merchantCity.getOrNull())

                /**
                 * Sets [Builder.merchantCity] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCity] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantCity(merchantCity: JsonField<String>) = apply {
                    this.merchantCity = merchantCity
                }

                /** The country the merchant resides in. */
                fun merchantCountry(merchantCountry: String?) =
                    merchantCountry(JsonField.ofNullable(merchantCountry))

                /**
                 * Alias for calling [Builder.merchantCountry] with `merchantCountry.orElse(null)`.
                 */
                fun merchantCountry(merchantCountry: Optional<String>) =
                    merchantCountry(merchantCountry.getOrNull())

                /**
                 * Sets [Builder.merchantCountry] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCountry] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCountry(merchantCountry: JsonField<String>) = apply {
                    this.merchantCountry = merchantCountry
                }

                /** The merchant descriptor of the merchant the card is transacting with. */
                fun merchantDescriptor(merchantDescriptor: String) =
                    merchantDescriptor(JsonField.of(merchantDescriptor))

                /**
                 * Sets [Builder.merchantDescriptor] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantDescriptor] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantDescriptor(merchantDescriptor: JsonField<String>) = apply {
                    this.merchantDescriptor = merchantDescriptor
                }

                /**
                 * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit
                 * ZIP code, where the first 5 and last 4 are separated by a dash.
                 */
                fun merchantPostalCode(merchantPostalCode: String?) =
                    merchantPostalCode(JsonField.ofNullable(merchantPostalCode))

                /**
                 * Alias for calling [Builder.merchantPostalCode] with
                 * `merchantPostalCode.orElse(null)`.
                 */
                fun merchantPostalCode(merchantPostalCode: Optional<String>) =
                    merchantPostalCode(merchantPostalCode.getOrNull())

                /**
                 * Sets [Builder.merchantPostalCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantPostalCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantPostalCode(merchantPostalCode: JsonField<String>) = apply {
                    this.merchantPostalCode = merchantPostalCode
                }

                /** The state the merchant resides in. */
                fun merchantState(merchantState: String?) =
                    merchantState(JsonField.ofNullable(merchantState))

                /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */
                fun merchantState(merchantState: Optional<String>) =
                    merchantState(merchantState.getOrNull())

                /**
                 * Sets [Builder.merchantState] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantState] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantState(merchantState: JsonField<String>) = apply {
                    this.merchantState = merchantState
                }

                /** The card network used to process this card authorization. */
                fun network(network: Network) = network(JsonField.of(network))

                /**
                 * Sets [Builder.network] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.network] with a well-typed [Network] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun network(network: JsonField<Network>) = apply { this.network = network }

                /** Network-specific identifiers for a specific request or transaction. */
                fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) =
                    networkIdentifiers(JsonField.of(networkIdentifiers))

                /**
                 * Sets [Builder.networkIdentifiers] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkIdentifiers] with a well-typed
                 * [NetworkIdentifiers] value instead. This method is primarily for setting the
                 * field to an undocumented or not yet supported value.
                 */
                fun networkIdentifiers(networkIdentifiers: JsonField<NetworkIdentifiers>) = apply {
                    this.networkIdentifiers = networkIdentifiers
                }

                /** The identifier of the Pending Transaction associated with this Card Reversal. */
                fun pendingTransactionId(pendingTransactionId: String?) =
                    pendingTransactionId(JsonField.ofNullable(pendingTransactionId))

                /**
                 * Alias for calling [Builder.pendingTransactionId] with
                 * `pendingTransactionId.orElse(null)`.
                 */
                fun pendingTransactionId(pendingTransactionId: Optional<String>) =
                    pendingTransactionId(pendingTransactionId.getOrNull())

                /**
                 * Sets [Builder.pendingTransactionId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.pendingTransactionId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun pendingTransactionId(pendingTransactionId: JsonField<String>) = apply {
                    this.pendingTransactionId = pendingTransactionId
                }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's
                 * presentment currency.
                 */
                fun presentmentCurrency(presentmentCurrency: String) =
                    presentmentCurrency(JsonField.of(presentmentCurrency))

                /**
                 * Sets [Builder.presentmentCurrency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.presentmentCurrency] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun presentmentCurrency(presentmentCurrency: JsonField<String>) = apply {
                    this.presentmentCurrency = presentmentCurrency
                }

                /**
                 * The amount of this reversal in the minor unit of the transaction's currency. For
                 * dollars, for example, this is cents.
                 */
                fun reversalAmount(reversalAmount: Long) =
                    reversalAmount(JsonField.of(reversalAmount))

                /**
                 * Sets [Builder.reversalAmount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.reversalAmount] with a well-typed [Long] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun reversalAmount(reversalAmount: JsonField<Long>) = apply {
                    this.reversalAmount = reversalAmount
                }

                /**
                 * The amount of this reversal in the minor unit of the transaction's presentment
                 * currency. For dollars, for example, this is cents.
                 */
                fun reversalPresentmentAmount(reversalPresentmentAmount: Long) =
                    reversalPresentmentAmount(JsonField.of(reversalPresentmentAmount))

                /**
                 * Sets [Builder.reversalPresentmentAmount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.reversalPresentmentAmount] with a well-typed
                 * [Long] value instead. This method is primarily for setting the field to an
                 * undocumented or not yet supported value.
                 */
                fun reversalPresentmentAmount(reversalPresentmentAmount: JsonField<Long>) = apply {
                    this.reversalPresentmentAmount = reversalPresentmentAmount
                }

                /** Why this reversal was initiated. */
                fun reversalReason(reversalReason: ReversalReason?) =
                    reversalReason(JsonField.ofNullable(reversalReason))

                /**
                 * Alias for calling [Builder.reversalReason] with `reversalReason.orElse(null)`.
                 */
                fun reversalReason(reversalReason: Optional<ReversalReason>) =
                    reversalReason(reversalReason.getOrNull())

                /**
                 * Sets [Builder.reversalReason] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.reversalReason] with a well-typed
                 * [ReversalReason] value instead. This method is primarily for setting the field to
                 * an undocumented or not yet supported value.
                 */
                fun reversalReason(reversalReason: JsonField<ReversalReason>) = apply {
                    this.reversalReason = reversalReason
                }

                /** The scheme fees associated with this card reversal. */
                fun schemeFees(schemeFees: List<SchemeFee>) = schemeFees(JsonField.of(schemeFees))

                /**
                 * Sets [Builder.schemeFees] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.schemeFees] with a well-typed `List<SchemeFee>`
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun schemeFees(schemeFees: JsonField<List<SchemeFee>>) = apply {
                    this.schemeFees = schemeFees.map { it.toMutableList() }
                }

                /**
                 * Adds a single [SchemeFee] to [schemeFees].
                 *
                 * @throws IllegalStateException if the field was previously set to a non-list.
                 */
                fun addSchemeFee(schemeFee: SchemeFee) = apply {
                    schemeFees =
                        (schemeFees ?: JsonField.of(mutableListOf())).also {
                            checkKnown("schemeFees", it).add(schemeFee)
                        }
                }

                /**
                 * The terminal identifier (commonly abbreviated as TID) of the terminal the card is
                 * transacting with.
                 */
                fun terminalId(terminalId: String?) = terminalId(JsonField.ofNullable(terminalId))

                /** Alias for calling [Builder.terminalId] with `terminalId.orElse(null)`. */
                fun terminalId(terminalId: Optional<String>) = terminalId(terminalId.getOrNull())

                /**
                 * Sets [Builder.terminalId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.terminalId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun terminalId(terminalId: JsonField<String>) = apply {
                    this.terminalId = terminalId
                }

                /**
                 * A constant representing the object's type. For this resource it will always be
                 * `card_reversal`.
                 */
                fun type(type: Type) = type(JsonField.of(type))

                /**
                 * Sets [Builder.type] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.type] with a well-typed [Type] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun type(type: JsonField<Type>) = apply { this.type = type }

                /**
                 * The amount left pending on the Card Authorization in the minor unit of the
                 * transaction's currency. For dollars, for example, this is cents.
                 */
                fun updatedAuthorizationAmount(updatedAuthorizationAmount: Long) =
                    updatedAuthorizationAmount(JsonField.of(updatedAuthorizationAmount))

                /**
                 * Sets [Builder.updatedAuthorizationAmount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.updatedAuthorizationAmount] with a well-typed
                 * [Long] value instead. This method is primarily for setting the field to an
                 * undocumented or not yet supported value.
                 */
                fun updatedAuthorizationAmount(updatedAuthorizationAmount: JsonField<Long>) =
                    apply {
                        this.updatedAuthorizationAmount = updatedAuthorizationAmount
                    }

                /**
                 * The amount left pending on the Card Authorization in the minor unit of the
                 * transaction's presentment currency. For dollars, for example, this is cents.
                 */
                fun updatedAuthorizationPresentmentAmount(
                    updatedAuthorizationPresentmentAmount: Long
                ) =
                    updatedAuthorizationPresentmentAmount(
                        JsonField.of(updatedAuthorizationPresentmentAmount)
                    )

                /**
                 * Sets [Builder.updatedAuthorizationPresentmentAmount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.updatedAuthorizationPresentmentAmount] with a
                 * well-typed [Long] value instead. This method is primarily for setting the field
                 * to an undocumented or not yet supported value.
                 */
                fun updatedAuthorizationPresentmentAmount(
                    updatedAuthorizationPresentmentAmount: JsonField<Long>
                ) = apply {
                    this.updatedAuthorizationPresentmentAmount =
                        updatedAuthorizationPresentmentAmount
                }

                fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                    this.additionalProperties.clear()
                    putAllAdditionalProperties(additionalProperties)
                }

                fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                    additionalProperties.put(key, value)
                }

                fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun removeAdditionalProperty(key: String) = apply {
                    additionalProperties.remove(key)
                }

                fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                    keys.forEach(::removeAdditionalProperty)
                }

                /**
                 * Returns an immutable instance of [CardReversal].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .cardAuthorizationId()
                 * .currency()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCity()
                 * .merchantCountry()
                 * .merchantDescriptor()
                 * .merchantPostalCode()
                 * .merchantState()
                 * .network()
                 * .networkIdentifiers()
                 * .pendingTransactionId()
                 * .presentmentCurrency()
                 * .reversalAmount()
                 * .reversalPresentmentAmount()
                 * .reversalReason()
                 * .schemeFees()
                 * .terminalId()
                 * .type()
                 * .updatedAuthorizationAmount()
                 * .updatedAuthorizationPresentmentAmount()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardReversal =
                    CardReversal(
                        checkRequired("id", id),
                        checkRequired("cardAuthorizationId", cardAuthorizationId),
                        checkRequired("currency", currency),
                        checkRequired("merchantAcceptorId", merchantAcceptorId),
                        checkRequired("merchantCategoryCode", merchantCategoryCode),
                        checkRequired("merchantCity", merchantCity),
                        checkRequired("merchantCountry", merchantCountry),
                        checkRequired("merchantDescriptor", merchantDescriptor),
                        checkRequired("merchantPostalCode", merchantPostalCode),
                        checkRequired("merchantState", merchantState),
                        checkRequired("network", network),
                        checkRequired("networkIdentifiers", networkIdentifiers),
                        checkRequired("pendingTransactionId", pendingTransactionId),
                        checkRequired("presentmentCurrency", presentmentCurrency),
                        checkRequired("reversalAmount", reversalAmount),
                        checkRequired("reversalPresentmentAmount", reversalPresentmentAmount),
                        checkRequired("reversalReason", reversalReason),
                        checkRequired("schemeFees", schemeFees).map { it.toImmutable() },
                        checkRequired("terminalId", terminalId),
                        checkRequired("type", type),
                        checkRequired("updatedAuthorizationAmount", updatedAuthorizationAmount),
                        checkRequired(
                            "updatedAuthorizationPresentmentAmount",
                            updatedAuthorizationPresentmentAmount,
                        ),
                        additionalProperties.toMutableMap(),
                    )
            }

            private var validated: Boolean = false

            /**
             * Validates that the types of all values in this object match their expected types
             * recursively.
             *
             * This method is _not_ forwards compatible with new types from the API for existing
             * fields.
             *
             * @throws IncreaseInvalidDataException if any value type in this object doesn't match
             *   its expected type.
             */
            fun validate(): CardReversal = apply {
                if (validated) {
                    return@apply
                }

                id()
                cardAuthorizationId()
                currency().validate()
                merchantAcceptorId()
                merchantCategoryCode()
                merchantCity()
                merchantCountry()
                merchantDescriptor()
                merchantPostalCode()
                merchantState()
                network().validate()
                networkIdentifiers().validate()
                pendingTransactionId()
                presentmentCurrency()
                reversalAmount()
                reversalPresentmentAmount()
                reversalReason().ifPresent { it.validate() }
                schemeFees().forEach { it.validate() }
                terminalId()
                type().validate()
                updatedAuthorizationAmount()
                updatedAuthorizationPresentmentAmount()
                validated = true
            }

            fun isValid(): Boolean =
                try {
                    validate()
                    true
                } catch (e: IncreaseInvalidDataException) {
                    false
                }

            /**
             * Returns a score indicating how many valid values are contained in this object
             * recursively.
             *
             * Used for best match union deserialization.
             */
            @JvmSynthetic
            internal fun validity(): Int =
                (if (id.asKnown().isPresent) 1 else 0) +
                    (if (cardAuthorizationId.asKnown().isPresent) 1 else 0) +
                    (currency.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) +
                    (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantCity.asKnown().isPresent) 1 else 0) +
                    (if (merchantCountry.asKnown().isPresent) 1 else 0) +
                    (if (merchantDescriptor.asKnown().isPresent) 1 else 0) +
                    (if (merchantPostalCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantState.asKnown().isPresent) 1 else 0) +
                    (network.asKnown().getOrNull()?.validity() ?: 0) +
                    (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (pendingTransactionId.asKnown().isPresent) 1 else 0) +
                    (if (presentmentCurrency.asKnown().isPresent) 1 else 0) +
                    (if (reversalAmount.asKnown().isPresent) 1 else 0) +
                    (if (reversalPresentmentAmount.asKnown().isPresent) 1 else 0) +
                    (reversalReason.asKnown().getOrNull()?.validity() ?: 0) +
                    (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
                    (if (terminalId.asKnown().isPresent) 1 else 0) +
                    (type.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (updatedAuthorizationAmount.asKnown().isPresent) 1 else 0) +
                    (if (updatedAuthorizationPresentmentAmount.asKnown().isPresent) 1 else 0)

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's
             * currency.
             */
            class Currency @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** US Dollar (USD) */
                    @JvmField val USD = of("USD")

                    @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                }

                /** An enum containing [Currency]'s known values. */
                enum class Known {
                    /** US Dollar (USD) */
                    USD
                }

                /**
                 * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Currency] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** US Dollar (USD) */
                    USD,
                    /**
                     * An enum member indicating that [Currency] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        USD -> Value.USD
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        USD -> Known.USD
                        else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Currency = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Currency && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** The card network used to process this card authorization. */
            class Network @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** Visa */
                    @JvmField val VISA = of("visa")

                    /** Pulse */
                    @JvmField val PULSE = of("pulse")

                    @JvmStatic fun of(value: String) = Network(JsonField.of(value))
                }

                /** An enum containing [Network]'s known values. */
                enum class Known {
                    /** Visa */
                    VISA,
                    /** Pulse */
                    PULSE,
                }

                /**
                 * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Network] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** Visa */
                    VISA,
                    /** Pulse */
                    PULSE,
                    /**
                     * An enum member indicating that [Network] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        VISA -> Value.VISA
                        PULSE -> Value.PULSE
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        VISA -> Known.VISA
                        PULSE -> Known.PULSE
                        else -> throw IncreaseInvalidDataException("Unknown Network: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Network = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Network && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** Network-specific identifiers for a specific request or transaction. */
            class NetworkIdentifiers
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val authorizationIdentificationResponse: JsonField<String>,
                private val retrievalReferenceNumber: JsonField<String>,
                private val traceNumber: JsonField<String>,
                private val transactionId: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("authorization_identification_response")
                    @ExcludeMissing
                    authorizationIdentificationResponse: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("retrieval_reference_number")
                    @ExcludeMissing
                    retrievalReferenceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("trace_number")
                    @ExcludeMissing
                    traceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("transaction_id")
                    @ExcludeMissing
                    transactionId: JsonField<String> = JsonMissing.of(),
                ) : this(
                    authorizationIdentificationResponse,
                    retrievalReferenceNumber,
                    traceNumber,
                    transactionId,
                    mutableMapOf(),
                )

                /**
                 * The randomly generated 6-character Authorization Identification Response code
                 * sent back to the acquirer in an approved response.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun authorizationIdentificationResponse(): Optional<String> =
                    authorizationIdentificationResponse.getOptional(
                        "authorization_identification_response"
                    )

                /**
                 * A life-cycle identifier used across e.g., an authorization and a reversal.
                 * Expected to be unique per acquirer within a window of time. For some card
                 * networks the retrieval reference number includes the trace counter.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun retrievalReferenceNumber(): Optional<String> =
                    retrievalReferenceNumber.getOptional("retrieval_reference_number")

                /**
                 * A counter used to verify an individual authorization. Expected to be unique per
                 * acquirer within a window of time.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun traceNumber(): Optional<String> = traceNumber.getOptional("trace_number")

                /**
                 * A globally unique transaction identifier provided by the card network, used
                 * across multiple life-cycle requests.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun transactionId(): Optional<String> = transactionId.getOptional("transaction_id")

                /**
                 * Returns the raw JSON value of [authorizationIdentificationResponse].
                 *
                 * Unlike [authorizationIdentificationResponse], this method doesn't throw if the
                 * JSON field has an unexpected type.
                 */
                @JsonProperty("authorization_identification_response")
                @ExcludeMissing
                fun _authorizationIdentificationResponse(): JsonField<String> =
                    authorizationIdentificationResponse

                /**
                 * Returns the raw JSON value of [retrievalReferenceNumber].
                 *
                 * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field
                 * has an unexpected type.
                 */
                @JsonProperty("retrieval_reference_number")
                @ExcludeMissing
                fun _retrievalReferenceNumber(): JsonField<String> = retrievalReferenceNumber

                /**
                 * Returns the raw JSON value of [traceNumber].
                 *
                 * Unlike [traceNumber], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("trace_number")
                @ExcludeMissing
                fun _traceNumber(): JsonField<String> = traceNumber

                /**
                 * Returns the raw JSON value of [transactionId].
                 *
                 * Unlike [transactionId], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("transaction_id")
                @ExcludeMissing
                fun _transactionId(): JsonField<String> = transactionId

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of
                     * [NetworkIdentifiers].
                     *
                     * The following fields are required:
                     * ```java
                     * .authorizationIdentificationResponse()
                     * .retrievalReferenceNumber()
                     * .traceNumber()
                     * .transactionId()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [NetworkIdentifiers]. */
                class Builder internal constructor() {

                    private var authorizationIdentificationResponse: JsonField<String>? = null
                    private var retrievalReferenceNumber: JsonField<String>? = null
                    private var traceNumber: JsonField<String>? = null
                    private var transactionId: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(networkIdentifiers: NetworkIdentifiers) = apply {
                        authorizationIdentificationResponse =
                            networkIdentifiers.authorizationIdentificationResponse
                        retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber
                        traceNumber = networkIdentifiers.traceNumber
                        transactionId = networkIdentifiers.transactionId
                        additionalProperties =
                            networkIdentifiers.additionalProperties.toMutableMap()
                    }

                    /**
                     * The randomly generated 6-character Authorization Identification Response code
                     * sent back to the acquirer in an approved response.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: String?
                    ) =
                        authorizationIdentificationResponse(
                            JsonField.ofNullable(authorizationIdentificationResponse)
                        )

                    /**
                     * Alias for calling [Builder.authorizationIdentificationResponse] with
                     * `authorizationIdentificationResponse.orElse(null)`.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: Optional<String>
                    ) =
                        authorizationIdentificationResponse(
                            authorizationIdentificationResponse.getOrNull()
                        )

                    /**
                     * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON
                     * value.
                     *
                     * You should usually call [Builder.authorizationIdentificationResponse] with a
                     * well-typed [String] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: JsonField<String>
                    ) = apply {
                        this.authorizationIdentificationResponse =
                            authorizationIdentificationResponse
                    }

                    /**
                     * A life-cycle identifier used across e.g., an authorization and a reversal.
                     * Expected to be unique per acquirer within a window of time. For some card
                     * networks the retrieval reference number includes the trace counter.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: String?) =
                        retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber))

                    /**
                     * Alias for calling [Builder.retrievalReferenceNumber] with
                     * `retrievalReferenceNumber.orElse(null)`.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: Optional<String>) =
                        retrievalReferenceNumber(retrievalReferenceNumber.getOrNull())

                    /**
                     * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.retrievalReferenceNumber] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField<String>) =
                        apply {
                            this.retrievalReferenceNumber = retrievalReferenceNumber
                        }

                    /**
                     * A counter used to verify an individual authorization. Expected to be unique
                     * per acquirer within a window of time.
                     */
                    fun traceNumber(traceNumber: String?) =
                        traceNumber(JsonField.ofNullable(traceNumber))

                    /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */
                    fun traceNumber(traceNumber: Optional<String>) =
                        traceNumber(traceNumber.getOrNull())

                    /**
                     * Sets [Builder.traceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.traceNumber] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun traceNumber(traceNumber: JsonField<String>) = apply {
                        this.traceNumber = traceNumber
                    }

                    /**
                     * A globally unique transaction identifier provided by the card network, used
                     * across multiple life-cycle requests.
                     */
                    fun transactionId(transactionId: String?) =
                        transactionId(JsonField.ofNullable(transactionId))

                    /**
                     * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`.
                     */
                    fun transactionId(transactionId: Optional<String>) =
                        transactionId(transactionId.getOrNull())

                    /**
                     * Sets [Builder.transactionId] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.transactionId] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun transactionId(transactionId: JsonField<String>) = apply {
                        this.transactionId = transactionId
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [NetworkIdentifiers].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .authorizationIdentificationResponse()
                     * .retrievalReferenceNumber()
                     * .traceNumber()
                     * .transactionId()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): NetworkIdentifiers =
                        NetworkIdentifiers(
                            checkRequired(
                                "authorizationIdentificationResponse",
                                authorizationIdentificationResponse,
                            ),
                            checkRequired("retrievalReferenceNumber", retrievalReferenceNumber),
                            checkRequired("traceNumber", traceNumber),
                            checkRequired("transactionId", transactionId),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): NetworkIdentifiers = apply {
                    if (validated) {
                        return@apply
                    }

                    authorizationIdentificationResponse()
                    retrievalReferenceNumber()
                    traceNumber()
                    transactionId()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) +
                        (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) +
                        (if (traceNumber.asKnown().isPresent) 1 else 0) +
                        (if (transactionId.asKnown().isPresent) 1 else 0)

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is NetworkIdentifiers &&
                        authorizationIdentificationResponse ==
                            other.authorizationIdentificationResponse &&
                        retrievalReferenceNumber == other.retrievalReferenceNumber &&
                        traceNumber == other.traceNumber &&
                        transactionId == other.transactionId &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        authorizationIdentificationResponse,
                        retrievalReferenceNumber,
                        traceNumber,
                        transactionId,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}"
            }

            /** Why this reversal was initiated. */
            class ReversalReason
            @JsonCreator
            private constructor(private val value: JsonField<String>) : Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** The Card Reversal was initiated at the customer's request. */
                    @JvmField val REVERSED_BY_CUSTOMER = of("reversed_by_customer")

                    /** The Card Reversal was initiated by the network or acquirer. */
                    @JvmField
                    val REVERSED_BY_NETWORK_OR_ACQUIRER = of("reversed_by_network_or_acquirer")

                    /** The Card Reversal was initiated by the point of sale device. */
                    @JvmField val REVERSED_BY_POINT_OF_SALE = of("reversed_by_point_of_sale")

                    /** The Card Reversal was a partial reversal, for any reason. */
                    @JvmField val PARTIAL_REVERSAL = of("partial_reversal")

                    @JvmStatic fun of(value: String) = ReversalReason(JsonField.of(value))
                }

                /** An enum containing [ReversalReason]'s known values. */
                enum class Known {
                    /** The Card Reversal was initiated at the customer's request. */
                    REVERSED_BY_CUSTOMER,
                    /** The Card Reversal was initiated by the network or acquirer. */
                    REVERSED_BY_NETWORK_OR_ACQUIRER,
                    /** The Card Reversal was initiated by the point of sale device. */
                    REVERSED_BY_POINT_OF_SALE,
                    /** The Card Reversal was a partial reversal, for any reason. */
                    PARTIAL_REVERSAL,
                }

                /**
                 * An enum containing [ReversalReason]'s known values, as well as an [_UNKNOWN]
                 * member.
                 *
                 * An instance of [ReversalReason] can contain an unknown value in a couple of
                 * cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** The Card Reversal was initiated at the customer's request. */
                    REVERSED_BY_CUSTOMER,
                    /** The Card Reversal was initiated by the network or acquirer. */
                    REVERSED_BY_NETWORK_OR_ACQUIRER,
                    /** The Card Reversal was initiated by the point of sale device. */
                    REVERSED_BY_POINT_OF_SALE,
                    /** The Card Reversal was a partial reversal, for any reason. */
                    PARTIAL_REVERSAL,
                    /**
                     * An enum member indicating that [ReversalReason] was instantiated with an
                     * unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        REVERSED_BY_CUSTOMER -> Value.REVERSED_BY_CUSTOMER
                        REVERSED_BY_NETWORK_OR_ACQUIRER -> Value.REVERSED_BY_NETWORK_OR_ACQUIRER
                        REVERSED_BY_POINT_OF_SALE -> Value.REVERSED_BY_POINT_OF_SALE
                        PARTIAL_REVERSAL -> Value.PARTIAL_REVERSAL
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        REVERSED_BY_CUSTOMER -> Known.REVERSED_BY_CUSTOMER
                        REVERSED_BY_NETWORK_OR_ACQUIRER -> Known.REVERSED_BY_NETWORK_OR_ACQUIRER
                        REVERSED_BY_POINT_OF_SALE -> Known.REVERSED_BY_POINT_OF_SALE
                        PARTIAL_REVERSAL -> Known.PARTIAL_REVERSAL
                        else -> throw IncreaseInvalidDataException("Unknown ReversalReason: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): ReversalReason = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is ReversalReason && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            class SchemeFee
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val amount: JsonField<String>,
                private val createdAt: JsonField<OffsetDateTime>,
                private val currency: JsonField<Currency>,
                private val feeType: JsonField<FeeType>,
                private val fixedComponent: JsonField<String>,
                private val variableRate: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("amount")
                    @ExcludeMissing
                    amount: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("created_at")
                    @ExcludeMissing
                    createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                    @JsonProperty("currency")
                    @ExcludeMissing
                    currency: JsonField<Currency> = JsonMissing.of(),
                    @JsonProperty("fee_type")
                    @ExcludeMissing
                    feeType: JsonField<FeeType> = JsonMissing.of(),
                    @JsonProperty("fixed_component")
                    @ExcludeMissing
                    fixedComponent: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("variable_rate")
                    @ExcludeMissing
                    variableRate: JsonField<String> = JsonMissing.of(),
                ) : this(
                    amount,
                    createdAt,
                    currency,
                    feeType,
                    fixedComponent,
                    variableRate,
                    mutableMapOf(),
                )

                /**
                 * The fee amount given as a string containing a decimal number.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun amount(): String = amount.getRequired("amount")

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was
                 * created.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /**
                 * The type of fee being assessed.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun feeType(): FeeType = feeType.getRequired("fee_type")

                /**
                 * The fixed component of the fee, if applicable, given in major units of the fee
                 * amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun fixedComponent(): Optional<String> =
                    fixedComponent.getOptional("fixed_component")

                /**
                 * The variable rate component of the fee, if applicable, given as a decimal (e.g.,
                 * 0.015 for 1.5%).
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun variableRate(): Optional<String> = variableRate.getOptional("variable_rate")

                /**
                 * Returns the raw JSON value of [amount].
                 *
                 * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<String> = amount

                /**
                 * Returns the raw JSON value of [createdAt].
                 *
                 * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("created_at")
                @ExcludeMissing
                fun _createdAt(): JsonField<OffsetDateTime> = createdAt

                /**
                 * Returns the raw JSON value of [currency].
                 *
                 * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun _currency(): JsonField<Currency> = currency

                /**
                 * Returns the raw JSON value of [feeType].
                 *
                 * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("fee_type")
                @ExcludeMissing
                fun _feeType(): JsonField<FeeType> = feeType

                /**
                 * Returns the raw JSON value of [fixedComponent].
                 *
                 * Unlike [fixedComponent], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("fixed_component")
                @ExcludeMissing
                fun _fixedComponent(): JsonField<String> = fixedComponent

                /**
                 * Returns the raw JSON value of [variableRate].
                 *
                 * Unlike [variableRate], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("variable_rate")
                @ExcludeMissing
                fun _variableRate(): JsonField<String> = variableRate

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [SchemeFee].
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [SchemeFee]. */
                class Builder internal constructor() {

                    private var amount: JsonField<String>? = null
                    private var createdAt: JsonField<OffsetDateTime>? = null
                    private var currency: JsonField<Currency>? = null
                    private var feeType: JsonField<FeeType>? = null
                    private var fixedComponent: JsonField<String>? = null
                    private var variableRate: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(schemeFee: SchemeFee) = apply {
                        amount = schemeFee.amount
                        createdAt = schemeFee.createdAt
                        currency = schemeFee.currency
                        feeType = schemeFee.feeType
                        fixedComponent = schemeFee.fixedComponent
                        variableRate = schemeFee.variableRate
                        additionalProperties = schemeFee.additionalProperties.toMutableMap()
                    }

                    /** The fee amount given as a string containing a decimal number. */
                    fun amount(amount: String) = amount(JsonField.of(amount))

                    /**
                     * Sets [Builder.amount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.amount] with a well-typed [String] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun amount(amount: JsonField<String>) = apply { this.amount = amount }

                    /**
                     * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee
                     * was created.
                     */
                    fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt))

                    /**
                     * Sets [Builder.createdAt] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.createdAt] with a well-typed
                     * [OffsetDateTime] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply {
                        this.createdAt = createdAt
                    }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                     * reimbursement.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * Sets [Builder.currency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.currency] with a well-typed [Currency] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                    /** The type of fee being assessed. */
                    fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType))

                    /**
                     * Sets [Builder.feeType] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.feeType] with a well-typed [FeeType] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun feeType(feeType: JsonField<FeeType>) = apply { this.feeType = feeType }

                    /**
                     * The fixed component of the fee, if applicable, given in major units of the
                     * fee amount.
                     */
                    fun fixedComponent(fixedComponent: String?) =
                        fixedComponent(JsonField.ofNullable(fixedComponent))

                    /**
                     * Alias for calling [Builder.fixedComponent] with
                     * `fixedComponent.orElse(null)`.
                     */
                    fun fixedComponent(fixedComponent: Optional<String>) =
                        fixedComponent(fixedComponent.getOrNull())

                    /**
                     * Sets [Builder.fixedComponent] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.fixedComponent] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun fixedComponent(fixedComponent: JsonField<String>) = apply {
                        this.fixedComponent = fixedComponent
                    }

                    /**
                     * The variable rate component of the fee, if applicable, given as a decimal
                     * (e.g., 0.015 for 1.5%).
                     */
                    fun variableRate(variableRate: String?) =
                        variableRate(JsonField.ofNullable(variableRate))

                    /**
                     * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`.
                     */
                    fun variableRate(variableRate: Optional<String>) =
                        variableRate(variableRate.getOrNull())

                    /**
                     * Sets [Builder.variableRate] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.variableRate] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun variableRate(variableRate: JsonField<String>) = apply {
                        this.variableRate = variableRate
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [SchemeFee].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): SchemeFee =
                        SchemeFee(
                            checkRequired("amount", amount),
                            checkRequired("createdAt", createdAt),
                            checkRequired("currency", currency),
                            checkRequired("feeType", feeType),
                            checkRequired("fixedComponent", fixedComponent),
                            checkRequired("variableRate", variableRate),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): SchemeFee = apply {
                    if (validated) {
                        return@apply
                    }

                    amount()
                    createdAt()
                    currency().validate()
                    feeType().validate()
                    fixedComponent()
                    variableRate()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (amount.asKnown().isPresent) 1 else 0) +
                        (if (createdAt.asKnown().isPresent) 1 else 0) +
                        (currency.asKnown().getOrNull()?.validity() ?: 0) +
                        (feeType.asKnown().getOrNull()?.validity() ?: 0) +
                        (if (fixedComponent.asKnown().isPresent) 1 else 0) +
                        (if (variableRate.asKnown().isPresent) 1 else 0)

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 */
                class Currency
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** US Dollar (USD) */
                        @JvmField val USD = of("USD")

                        @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                    }

                    /** An enum containing [Currency]'s known values. */
                    enum class Known {
                        /** US Dollar (USD) */
                        USD
                    }

                    /**
                     * An enum containing [Currency]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Currency] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** US Dollar (USD) */
                        USD,
                        /**
                         * An enum member indicating that [Currency] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            USD -> Value.USD
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            USD -> Known.USD
                            else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Currency = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Currency && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** The type of fee being assessed. */
                class FeeType
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY =
                            of("visa_international_service_assessment_single_currency")

                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY =
                            of("visa_international_service_assessment_cross_currency")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE =
                            of("visa_authorization_domestic_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_international_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE =
                            of("visa_authorization_canada_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_international_point_of_sale")

                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE =
                            of("visa_authorization_address_verification_service")

                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        @JvmField
                        val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization")

                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission")

                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_DOMESTIC =
                            of("visa_account_verification_domestic")

                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL =
                            of("visa_account_verification_international")

                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_CANADA =
                            of("visa_account_verification_canada")

                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee")

                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        @JvmField
                        val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE =
                            of("visa_consumer_debit_acceptance_fee")

                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        @JvmField
                        val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE =
                            of("visa_business_debit_acceptance_fee")

                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee")

                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic")

                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        @JvmField
                        val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international")

                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token")

                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token")

                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission")

                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization")

                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        @JvmField
                        val VISA_DIRECT_TRANSACTION_DOMESTIC =
                            of("visa_direct_transaction_domestic")

                        /** Issuer card service fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit")

                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT =
                            of("visa_advertising_service_commercial_credit")

                        /** Issuer Community Growth Acceleration Program Fee. */
                        @JvmField
                        val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM =
                            of("visa_community_growth_acceleration_program")

                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        @JvmField
                        val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT =
                            of("visa_processing_guarantee_commercial_credit")

                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee")

                        @JvmStatic fun of(value: String) = FeeType(JsonField.of(value))
                    }

                    /** An enum containing [FeeType]'s known values. */
                    enum class Known {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                    }

                    /**
                     * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member.
                     *
                     * An instance of [FeeType] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                        /**
                         * An enum member indicating that [FeeType] was instantiated with an unknown
                         * value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Value.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Value.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Known.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Known.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE
                            else -> throw IncreaseInvalidDataException("Unknown FeeType: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): FeeType = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is FeeType && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is SchemeFee &&
                        amount == other.amount &&
                        createdAt == other.createdAt &&
                        currency == other.currency &&
                        feeType == other.feeType &&
                        fixedComponent == other.fixedComponent &&
                        variableRate == other.variableRate &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        amount,
                        createdAt,
                        currency,
                        feeType,
                        fixedComponent,
                        variableRate,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}"
            }

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_reversal`.
             */
            class Type @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    @JvmField val CARD_REVERSAL = of("card_reversal")

                    @JvmStatic fun of(value: String) = Type(JsonField.of(value))
                }

                /** An enum containing [Type]'s known values. */
                enum class Known {
                    CARD_REVERSAL
                }

                /**
                 * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Type] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    CARD_REVERSAL,
                    /**
                     * An enum member indicating that [Type] was instantiated with an unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        CARD_REVERSAL -> Value.CARD_REVERSAL
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        CARD_REVERSAL -> Known.CARD_REVERSAL
                        else -> throw IncreaseInvalidDataException("Unknown Type: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Type = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Type && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            override fun equals(other: Any?): Boolean {
                if (this === other) {
                    return true
                }

                return other is CardReversal &&
                    id == other.id &&
                    cardAuthorizationId == other.cardAuthorizationId &&
                    currency == other.currency &&
                    merchantAcceptorId == other.merchantAcceptorId &&
                    merchantCategoryCode == other.merchantCategoryCode &&
                    merchantCity == other.merchantCity &&
                    merchantCountry == other.merchantCountry &&
                    merchantDescriptor == other.merchantDescriptor &&
                    merchantPostalCode == other.merchantPostalCode &&
                    merchantState == other.merchantState &&
                    network == other.network &&
                    networkIdentifiers == other.networkIdentifiers &&
                    pendingTransactionId == other.pendingTransactionId &&
                    presentmentCurrency == other.presentmentCurrency &&
                    reversalAmount == other.reversalAmount &&
                    reversalPresentmentAmount == other.reversalPresentmentAmount &&
                    reversalReason == other.reversalReason &&
                    schemeFees == other.schemeFees &&
                    terminalId == other.terminalId &&
                    type == other.type &&
                    updatedAuthorizationAmount == other.updatedAuthorizationAmount &&
                    updatedAuthorizationPresentmentAmount ==
                        other.updatedAuthorizationPresentmentAmount &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    id,
                    cardAuthorizationId,
                    currency,
                    merchantAcceptorId,
                    merchantCategoryCode,
                    merchantCity,
                    merchantCountry,
                    merchantDescriptor,
                    merchantPostalCode,
                    merchantState,
                    network,
                    networkIdentifiers,
                    pendingTransactionId,
                    presentmentCurrency,
                    reversalAmount,
                    reversalPresentmentAmount,
                    reversalReason,
                    schemeFees,
                    terminalId,
                    type,
                    updatedAuthorizationAmount,
                    updatedAuthorizationPresentmentAmount,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardReversal{id=$id, cardAuthorizationId=$cardAuthorizationId, currency=$currency, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, network=$network, networkIdentifiers=$networkIdentifiers, pendingTransactionId=$pendingTransactionId, presentmentCurrency=$presentmentCurrency, reversalAmount=$reversalAmount, reversalPresentmentAmount=$reversalPresentmentAmount, reversalReason=$reversalReason, schemeFees=$schemeFees, terminalId=$terminalId, type=$type, updatedAuthorizationAmount=$updatedAuthorizationAmount, updatedAuthorizationPresentmentAmount=$updatedAuthorizationPresentmentAmount, additionalProperties=$additionalProperties}"
        }

        /**
         * A Card Settlement object. This field will be present in the JSON response if and only if
         * `category` is equal to `card_settlement`. Card Settlements are card transactions that
         * have cleared and settled. While a settlement is usually preceded by an authorization, an
         * acquirer can also directly clear a transaction without first authorizing it.
         */
        class CardSettlement
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val id: JsonField<String>,
            private val amount: JsonField<Long>,
            private val cardAuthorization: JsonField<String>,
            private val cardPaymentId: JsonField<String>,
            private val cashback: JsonField<Cashback>,
            private val currency: JsonField<Currency>,
            private val interchange: JsonField<Interchange>,
            private val merchantAcceptorId: JsonField<String>,
            private val merchantCategoryCode: JsonField<String>,
            private val merchantCity: JsonField<String>,
            private val merchantCountry: JsonField<String>,
            private val merchantName: JsonField<String>,
            private val merchantPostalCode: JsonField<String>,
            private val merchantState: JsonField<String>,
            private val network: JsonField<Network>,
            private val networkIdentifiers: JsonField<NetworkIdentifiers>,
            private val pendingTransactionId: JsonField<String>,
            private val presentmentAmount: JsonField<Long>,
            private val presentmentCurrency: JsonField<String>,
            private val purchaseDetails: JsonField<PurchaseDetails>,
            private val schemeFees: JsonField<List<SchemeFee>>,
            private val surcharge: JsonField<Surcharge>,
            private val transactionId: JsonField<String>,
            private val type: JsonField<Type>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("card_authorization")
                @ExcludeMissing
                cardAuthorization: JsonField<String> = JsonMissing.of(),
                @JsonProperty("card_payment_id")
                @ExcludeMissing
                cardPaymentId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("cashback")
                @ExcludeMissing
                cashback: JsonField<Cashback> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("interchange")
                @ExcludeMissing
                interchange: JsonField<Interchange> = JsonMissing.of(),
                @JsonProperty("merchant_acceptor_id")
                @ExcludeMissing
                merchantAcceptorId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_category_code")
                @ExcludeMissing
                merchantCategoryCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_city")
                @ExcludeMissing
                merchantCity: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_country")
                @ExcludeMissing
                merchantCountry: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_name")
                @ExcludeMissing
                merchantName: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_postal_code")
                @ExcludeMissing
                merchantPostalCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_state")
                @ExcludeMissing
                merchantState: JsonField<String> = JsonMissing.of(),
                @JsonProperty("network")
                @ExcludeMissing
                network: JsonField<Network> = JsonMissing.of(),
                @JsonProperty("network_identifiers")
                @ExcludeMissing
                networkIdentifiers: JsonField<NetworkIdentifiers> = JsonMissing.of(),
                @JsonProperty("pending_transaction_id")
                @ExcludeMissing
                pendingTransactionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("presentment_amount")
                @ExcludeMissing
                presentmentAmount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("presentment_currency")
                @ExcludeMissing
                presentmentCurrency: JsonField<String> = JsonMissing.of(),
                @JsonProperty("purchase_details")
                @ExcludeMissing
                purchaseDetails: JsonField<PurchaseDetails> = JsonMissing.of(),
                @JsonProperty("scheme_fees")
                @ExcludeMissing
                schemeFees: JsonField<List<SchemeFee>> = JsonMissing.of(),
                @JsonProperty("surcharge")
                @ExcludeMissing
                surcharge: JsonField<Surcharge> = JsonMissing.of(),
                @JsonProperty("transaction_id")
                @ExcludeMissing
                transactionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
            ) : this(
                id,
                amount,
                cardAuthorization,
                cardPaymentId,
                cashback,
                currency,
                interchange,
                merchantAcceptorId,
                merchantCategoryCode,
                merchantCity,
                merchantCountry,
                merchantName,
                merchantPostalCode,
                merchantState,
                network,
                networkIdentifiers,
                pendingTransactionId,
                presentmentAmount,
                presentmentCurrency,
                purchaseDetails,
                schemeFees,
                surcharge,
                transactionId,
                type,
                mutableMapOf(),
            )

            /**
             * The Card Settlement identifier.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun id(): String = id.getRequired("id")

            /**
             * The amount in the minor unit of the transaction's settlement currency. For dollars,
             * for example, this is cents.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun amount(): Long = amount.getRequired("amount")

            /**
             * The Card Authorization that was created prior to this Card Settlement, if one exists.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun cardAuthorization(): Optional<String> =
                cardAuthorization.getOptional("card_authorization")

            /**
             * The ID of the Card Payment this transaction belongs to.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun cardPaymentId(): String = cardPaymentId.getRequired("card_payment_id")

            /**
             * Cashback earned on this transaction, if eligible. Cashback is paid out in aggregate,
             * monthly.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun cashback(): Optional<Cashback> = cashback.getOptional("cashback")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
             * settlement currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun currency(): Currency = currency.getRequired("currency")

            /**
             * Interchange assessed as a part of this transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun interchange(): Optional<Interchange> = interchange.getOptional("interchange")

            /**
             * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantAcceptorId(): String =
                merchantAcceptorId.getRequired("merchant_acceptor_id")

            /**
             * The 4-digit MCC describing the merchant's business.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCategoryCode(): String =
                merchantCategoryCode.getRequired("merchant_category_code")

            /**
             * The city the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCity(): String = merchantCity.getRequired("merchant_city")

            /**
             * The country the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCountry(): String = merchantCountry.getRequired("merchant_country")

            /**
             * The name of the merchant.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantName(): String = merchantName.getRequired("merchant_name")

            /**
             * The merchant's postal code. For US merchants this is always a 5-digit ZIP code.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantPostalCode(): Optional<String> =
                merchantPostalCode.getOptional("merchant_postal_code")

            /**
             * The state the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantState(): Optional<String> = merchantState.getOptional("merchant_state")

            /**
             * The card network on which this transaction was processed.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun network(): Network = network.getRequired("network")

            /**
             * Network-specific identifiers for this refund.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun networkIdentifiers(): NetworkIdentifiers =
                networkIdentifiers.getRequired("network_identifiers")

            /**
             * The identifier of the Pending Transaction associated with this Transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun pendingTransactionId(): Optional<String> =
                pendingTransactionId.getOptional("pending_transaction_id")

            /**
             * The amount in the minor unit of the transaction's presentment currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun presentmentAmount(): Long = presentmentAmount.getRequired("presentment_amount")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
             * presentment currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun presentmentCurrency(): String =
                presentmentCurrency.getRequired("presentment_currency")

            /**
             * Additional details about the card purchase, such as tax and industry-specific fields.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun purchaseDetails(): Optional<PurchaseDetails> =
                purchaseDetails.getOptional("purchase_details")

            /**
             * The scheme fees associated with this card settlement.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun schemeFees(): List<SchemeFee> = schemeFees.getRequired("scheme_fees")

            /**
             * Surcharge amount details, if applicable. The amount is positive if the surcharge is
             * added to the overall transaction amount (surcharge), and negative if the surcharge is
             * deducted from the overall transaction amount (discount).
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun surcharge(): Optional<Surcharge> = surcharge.getOptional("surcharge")

            /**
             * The identifier of the Transaction associated with this Transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun transactionId(): String = transactionId.getRequired("transaction_id")

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_settlement`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun type(): Type = type.getRequired("type")

            /**
             * Returns the raw JSON value of [id].
             *
             * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id

            /**
             * Returns the raw JSON value of [amount].
             *
             * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

            /**
             * Returns the raw JSON value of [cardAuthorization].
             *
             * Unlike [cardAuthorization], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("card_authorization")
            @ExcludeMissing
            fun _cardAuthorization(): JsonField<String> = cardAuthorization

            /**
             * Returns the raw JSON value of [cardPaymentId].
             *
             * Unlike [cardPaymentId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("card_payment_id")
            @ExcludeMissing
            fun _cardPaymentId(): JsonField<String> = cardPaymentId

            /**
             * Returns the raw JSON value of [cashback].
             *
             * Unlike [cashback], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("cashback")
            @ExcludeMissing
            fun _cashback(): JsonField<Cashback> = cashback

            /**
             * Returns the raw JSON value of [currency].
             *
             * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("currency")
            @ExcludeMissing
            fun _currency(): JsonField<Currency> = currency

            /**
             * Returns the raw JSON value of [interchange].
             *
             * Unlike [interchange], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("interchange")
            @ExcludeMissing
            fun _interchange(): JsonField<Interchange> = interchange

            /**
             * Returns the raw JSON value of [merchantAcceptorId].
             *
             * Unlike [merchantAcceptorId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_acceptor_id")
            @ExcludeMissing
            fun _merchantAcceptorId(): JsonField<String> = merchantAcceptorId

            /**
             * Returns the raw JSON value of [merchantCategoryCode].
             *
             * Unlike [merchantCategoryCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_category_code")
            @ExcludeMissing
            fun _merchantCategoryCode(): JsonField<String> = merchantCategoryCode

            /**
             * Returns the raw JSON value of [merchantCity].
             *
             * Unlike [merchantCity], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_city")
            @ExcludeMissing
            fun _merchantCity(): JsonField<String> = merchantCity

            /**
             * Returns the raw JSON value of [merchantCountry].
             *
             * Unlike [merchantCountry], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_country")
            @ExcludeMissing
            fun _merchantCountry(): JsonField<String> = merchantCountry

            /**
             * Returns the raw JSON value of [merchantName].
             *
             * Unlike [merchantName], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_name")
            @ExcludeMissing
            fun _merchantName(): JsonField<String> = merchantName

            /**
             * Returns the raw JSON value of [merchantPostalCode].
             *
             * Unlike [merchantPostalCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_postal_code")
            @ExcludeMissing
            fun _merchantPostalCode(): JsonField<String> = merchantPostalCode

            /**
             * Returns the raw JSON value of [merchantState].
             *
             * Unlike [merchantState], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_state")
            @ExcludeMissing
            fun _merchantState(): JsonField<String> = merchantState

            /**
             * Returns the raw JSON value of [network].
             *
             * Unlike [network], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("network") @ExcludeMissing fun _network(): JsonField<Network> = network

            /**
             * Returns the raw JSON value of [networkIdentifiers].
             *
             * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_identifiers")
            @ExcludeMissing
            fun _networkIdentifiers(): JsonField<NetworkIdentifiers> = networkIdentifiers

            /**
             * Returns the raw JSON value of [pendingTransactionId].
             *
             * Unlike [pendingTransactionId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("pending_transaction_id")
            @ExcludeMissing
            fun _pendingTransactionId(): JsonField<String> = pendingTransactionId

            /**
             * Returns the raw JSON value of [presentmentAmount].
             *
             * Unlike [presentmentAmount], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("presentment_amount")
            @ExcludeMissing
            fun _presentmentAmount(): JsonField<Long> = presentmentAmount

            /**
             * Returns the raw JSON value of [presentmentCurrency].
             *
             * Unlike [presentmentCurrency], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("presentment_currency")
            @ExcludeMissing
            fun _presentmentCurrency(): JsonField<String> = presentmentCurrency

            /**
             * Returns the raw JSON value of [purchaseDetails].
             *
             * Unlike [purchaseDetails], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("purchase_details")
            @ExcludeMissing
            fun _purchaseDetails(): JsonField<PurchaseDetails> = purchaseDetails

            /**
             * Returns the raw JSON value of [schemeFees].
             *
             * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("scheme_fees")
            @ExcludeMissing
            fun _schemeFees(): JsonField<List<SchemeFee>> = schemeFees

            /**
             * Returns the raw JSON value of [surcharge].
             *
             * Unlike [surcharge], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("surcharge")
            @ExcludeMissing
            fun _surcharge(): JsonField<Surcharge> = surcharge

            /**
             * Returns the raw JSON value of [transactionId].
             *
             * Unlike [transactionId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("transaction_id")
            @ExcludeMissing
            fun _transactionId(): JsonField<String> = transactionId

            /**
             * Returns the raw JSON value of [type].
             *
             * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("type") @ExcludeMissing fun _type(): JsonField<Type> = type

            @JsonAnySetter
            private fun putAdditionalProperty(key: String, value: JsonValue) {
                additionalProperties.put(key, value)
            }

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map<String, JsonValue> =
                Collections.unmodifiableMap(additionalProperties)

            fun toBuilder() = Builder().from(this)

            companion object {

                /**
                 * Returns a mutable builder for constructing an instance of [CardSettlement].
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .amount()
                 * .cardAuthorization()
                 * .cardPaymentId()
                 * .cashback()
                 * .currency()
                 * .interchange()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCity()
                 * .merchantCountry()
                 * .merchantName()
                 * .merchantPostalCode()
                 * .merchantState()
                 * .network()
                 * .networkIdentifiers()
                 * .pendingTransactionId()
                 * .presentmentAmount()
                 * .presentmentCurrency()
                 * .purchaseDetails()
                 * .schemeFees()
                 * .surcharge()
                 * .transactionId()
                 * .type()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

            /** A builder for [CardSettlement]. */
            class Builder internal constructor() {

                private var id: JsonField<String>? = null
                private var amount: JsonField<Long>? = null
                private var cardAuthorization: JsonField<String>? = null
                private var cardPaymentId: JsonField<String>? = null
                private var cashback: JsonField<Cashback>? = null
                private var currency: JsonField<Currency>? = null
                private var interchange: JsonField<Interchange>? = null
                private var merchantAcceptorId: JsonField<String>? = null
                private var merchantCategoryCode: JsonField<String>? = null
                private var merchantCity: JsonField<String>? = null
                private var merchantCountry: JsonField<String>? = null
                private var merchantName: JsonField<String>? = null
                private var merchantPostalCode: JsonField<String>? = null
                private var merchantState: JsonField<String>? = null
                private var network: JsonField<Network>? = null
                private var networkIdentifiers: JsonField<NetworkIdentifiers>? = null
                private var pendingTransactionId: JsonField<String>? = null
                private var presentmentAmount: JsonField<Long>? = null
                private var presentmentCurrency: JsonField<String>? = null
                private var purchaseDetails: JsonField<PurchaseDetails>? = null
                private var schemeFees: JsonField<MutableList<SchemeFee>>? = null
                private var surcharge: JsonField<Surcharge>? = null
                private var transactionId: JsonField<String>? = null
                private var type: JsonField<Type>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardSettlement: CardSettlement) = apply {
                    id = cardSettlement.id
                    amount = cardSettlement.amount
                    cardAuthorization = cardSettlement.cardAuthorization
                    cardPaymentId = cardSettlement.cardPaymentId
                    cashback = cardSettlement.cashback
                    currency = cardSettlement.currency
                    interchange = cardSettlement.interchange
                    merchantAcceptorId = cardSettlement.merchantAcceptorId
                    merchantCategoryCode = cardSettlement.merchantCategoryCode
                    merchantCity = cardSettlement.merchantCity
                    merchantCountry = cardSettlement.merchantCountry
                    merchantName = cardSettlement.merchantName
                    merchantPostalCode = cardSettlement.merchantPostalCode
                    merchantState = cardSettlement.merchantState
                    network = cardSettlement.network
                    networkIdentifiers = cardSettlement.networkIdentifiers
                    pendingTransactionId = cardSettlement.pendingTransactionId
                    presentmentAmount = cardSettlement.presentmentAmount
                    presentmentCurrency = cardSettlement.presentmentCurrency
                    purchaseDetails = cardSettlement.purchaseDetails
                    schemeFees = cardSettlement.schemeFees.map { it.toMutableList() }
                    surcharge = cardSettlement.surcharge
                    transactionId = cardSettlement.transactionId
                    type = cardSettlement.type
                    additionalProperties = cardSettlement.additionalProperties.toMutableMap()
                }

                /** The Card Settlement identifier. */
                fun id(id: String) = id(JsonField.of(id))

                /**
                 * Sets [Builder.id] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.id] with a well-typed [String] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun id(id: JsonField<String>) = apply { this.id = id }

                /**
                 * The amount in the minor unit of the transaction's settlement currency. For
                 * dollars, for example, this is cents.
                 */
                fun amount(amount: Long) = amount(JsonField.of(amount))

                /**
                 * Sets [Builder.amount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.amount] with a well-typed [Long] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                /**
                 * The Card Authorization that was created prior to this Card Settlement, if one
                 * exists.
                 */
                fun cardAuthorization(cardAuthorization: String?) =
                    cardAuthorization(JsonField.ofNullable(cardAuthorization))

                /**
                 * Alias for calling [Builder.cardAuthorization] with
                 * `cardAuthorization.orElse(null)`.
                 */
                fun cardAuthorization(cardAuthorization: Optional<String>) =
                    cardAuthorization(cardAuthorization.getOrNull())

                /**
                 * Sets [Builder.cardAuthorization] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cardAuthorization] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun cardAuthorization(cardAuthorization: JsonField<String>) = apply {
                    this.cardAuthorization = cardAuthorization
                }

                /** The ID of the Card Payment this transaction belongs to. */
                fun cardPaymentId(cardPaymentId: String) =
                    cardPaymentId(JsonField.of(cardPaymentId))

                /**
                 * Sets [Builder.cardPaymentId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cardPaymentId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun cardPaymentId(cardPaymentId: JsonField<String>) = apply {
                    this.cardPaymentId = cardPaymentId
                }

                /**
                 * Cashback earned on this transaction, if eligible. Cashback is paid out in
                 * aggregate, monthly.
                 */
                fun cashback(cashback: Cashback?) = cashback(JsonField.ofNullable(cashback))

                /** Alias for calling [Builder.cashback] with `cashback.orElse(null)`. */
                fun cashback(cashback: Optional<Cashback>) = cashback(cashback.getOrNull())

                /**
                 * Sets [Builder.cashback] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cashback] with a well-typed [Cashback] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun cashback(cashback: JsonField<Cashback>) = apply { this.cashback = cashback }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
                 * settlement currency.
                 */
                fun currency(currency: Currency) = currency(JsonField.of(currency))

                /**
                 * Sets [Builder.currency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.currency] with a well-typed [Currency] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                /** Interchange assessed as a part of this transaction. */
                fun interchange(interchange: Interchange?) =
                    interchange(JsonField.ofNullable(interchange))

                /** Alias for calling [Builder.interchange] with `interchange.orElse(null)`. */
                fun interchange(interchange: Optional<Interchange>) =
                    interchange(interchange.getOrNull())

                /**
                 * Sets [Builder.interchange] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.interchange] with a well-typed [Interchange]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun interchange(interchange: JsonField<Interchange>) = apply {
                    this.interchange = interchange
                }

                /**
                 * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
                 * transacting with.
                 */
                fun merchantAcceptorId(merchantAcceptorId: String) =
                    merchantAcceptorId(JsonField.of(merchantAcceptorId))

                /**
                 * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantAcceptorId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantAcceptorId(merchantAcceptorId: JsonField<String>) = apply {
                    this.merchantAcceptorId = merchantAcceptorId
                }

                /** The 4-digit MCC describing the merchant's business. */
                fun merchantCategoryCode(merchantCategoryCode: String) =
                    merchantCategoryCode(JsonField.of(merchantCategoryCode))

                /**
                 * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCategoryCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCategoryCode(merchantCategoryCode: JsonField<String>) = apply {
                    this.merchantCategoryCode = merchantCategoryCode
                }

                /** The city the merchant resides in. */
                fun merchantCity(merchantCity: String) = merchantCity(JsonField.of(merchantCity))

                /**
                 * Sets [Builder.merchantCity] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCity] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantCity(merchantCity: JsonField<String>) = apply {
                    this.merchantCity = merchantCity
                }

                /** The country the merchant resides in. */
                fun merchantCountry(merchantCountry: String) =
                    merchantCountry(JsonField.of(merchantCountry))

                /**
                 * Sets [Builder.merchantCountry] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCountry] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCountry(merchantCountry: JsonField<String>) = apply {
                    this.merchantCountry = merchantCountry
                }

                /** The name of the merchant. */
                fun merchantName(merchantName: String) = merchantName(JsonField.of(merchantName))

                /**
                 * Sets [Builder.merchantName] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantName] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantName(merchantName: JsonField<String>) = apply {
                    this.merchantName = merchantName
                }

                /**
                 * The merchant's postal code. For US merchants this is always a 5-digit ZIP code.
                 */
                fun merchantPostalCode(merchantPostalCode: String?) =
                    merchantPostalCode(JsonField.ofNullable(merchantPostalCode))

                /**
                 * Alias for calling [Builder.merchantPostalCode] with
                 * `merchantPostalCode.orElse(null)`.
                 */
                fun merchantPostalCode(merchantPostalCode: Optional<String>) =
                    merchantPostalCode(merchantPostalCode.getOrNull())

                /**
                 * Sets [Builder.merchantPostalCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantPostalCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantPostalCode(merchantPostalCode: JsonField<String>) = apply {
                    this.merchantPostalCode = merchantPostalCode
                }

                /** The state the merchant resides in. */
                fun merchantState(merchantState: String?) =
                    merchantState(JsonField.ofNullable(merchantState))

                /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */
                fun merchantState(merchantState: Optional<String>) =
                    merchantState(merchantState.getOrNull())

                /**
                 * Sets [Builder.merchantState] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantState] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantState(merchantState: JsonField<String>) = apply {
                    this.merchantState = merchantState
                }

                /** The card network on which this transaction was processed. */
                fun network(network: Network) = network(JsonField.of(network))

                /**
                 * Sets [Builder.network] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.network] with a well-typed [Network] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun network(network: JsonField<Network>) = apply { this.network = network }

                /** Network-specific identifiers for this refund. */
                fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) =
                    networkIdentifiers(JsonField.of(networkIdentifiers))

                /**
                 * Sets [Builder.networkIdentifiers] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkIdentifiers] with a well-typed
                 * [NetworkIdentifiers] value instead. This method is primarily for setting the
                 * field to an undocumented or not yet supported value.
                 */
                fun networkIdentifiers(networkIdentifiers: JsonField<NetworkIdentifiers>) = apply {
                    this.networkIdentifiers = networkIdentifiers
                }

                /** The identifier of the Pending Transaction associated with this Transaction. */
                fun pendingTransactionId(pendingTransactionId: String?) =
                    pendingTransactionId(JsonField.ofNullable(pendingTransactionId))

                /**
                 * Alias for calling [Builder.pendingTransactionId] with
                 * `pendingTransactionId.orElse(null)`.
                 */
                fun pendingTransactionId(pendingTransactionId: Optional<String>) =
                    pendingTransactionId(pendingTransactionId.getOrNull())

                /**
                 * Sets [Builder.pendingTransactionId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.pendingTransactionId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun pendingTransactionId(pendingTransactionId: JsonField<String>) = apply {
                    this.pendingTransactionId = pendingTransactionId
                }

                /** The amount in the minor unit of the transaction's presentment currency. */
                fun presentmentAmount(presentmentAmount: Long) =
                    presentmentAmount(JsonField.of(presentmentAmount))

                /**
                 * Sets [Builder.presentmentAmount] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.presentmentAmount] with a well-typed [Long]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun presentmentAmount(presentmentAmount: JsonField<Long>) = apply {
                    this.presentmentAmount = presentmentAmount
                }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
                 * presentment currency.
                 */
                fun presentmentCurrency(presentmentCurrency: String) =
                    presentmentCurrency(JsonField.of(presentmentCurrency))

                /**
                 * Sets [Builder.presentmentCurrency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.presentmentCurrency] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun presentmentCurrency(presentmentCurrency: JsonField<String>) = apply {
                    this.presentmentCurrency = presentmentCurrency
                }

                /**
                 * Additional details about the card purchase, such as tax and industry-specific
                 * fields.
                 */
                fun purchaseDetails(purchaseDetails: PurchaseDetails?) =
                    purchaseDetails(JsonField.ofNullable(purchaseDetails))

                /**
                 * Alias for calling [Builder.purchaseDetails] with `purchaseDetails.orElse(null)`.
                 */
                fun purchaseDetails(purchaseDetails: Optional<PurchaseDetails>) =
                    purchaseDetails(purchaseDetails.getOrNull())

                /**
                 * Sets [Builder.purchaseDetails] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.purchaseDetails] with a well-typed
                 * [PurchaseDetails] value instead. This method is primarily for setting the field
                 * to an undocumented or not yet supported value.
                 */
                fun purchaseDetails(purchaseDetails: JsonField<PurchaseDetails>) = apply {
                    this.purchaseDetails = purchaseDetails
                }

                /** The scheme fees associated with this card settlement. */
                fun schemeFees(schemeFees: List<SchemeFee>) = schemeFees(JsonField.of(schemeFees))

                /**
                 * Sets [Builder.schemeFees] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.schemeFees] with a well-typed `List<SchemeFee>`
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun schemeFees(schemeFees: JsonField<List<SchemeFee>>) = apply {
                    this.schemeFees = schemeFees.map { it.toMutableList() }
                }

                /**
                 * Adds a single [SchemeFee] to [schemeFees].
                 *
                 * @throws IllegalStateException if the field was previously set to a non-list.
                 */
                fun addSchemeFee(schemeFee: SchemeFee) = apply {
                    schemeFees =
                        (schemeFees ?: JsonField.of(mutableListOf())).also {
                            checkKnown("schemeFees", it).add(schemeFee)
                        }
                }

                /**
                 * Surcharge amount details, if applicable. The amount is positive if the surcharge
                 * is added to the overall transaction amount (surcharge), and negative if the
                 * surcharge is deducted from the overall transaction amount (discount).
                 */
                fun surcharge(surcharge: Surcharge?) = surcharge(JsonField.ofNullable(surcharge))

                /** Alias for calling [Builder.surcharge] with `surcharge.orElse(null)`. */
                fun surcharge(surcharge: Optional<Surcharge>) = surcharge(surcharge.getOrNull())

                /**
                 * Sets [Builder.surcharge] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.surcharge] with a well-typed [Surcharge] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun surcharge(surcharge: JsonField<Surcharge>) = apply {
                    this.surcharge = surcharge
                }

                /** The identifier of the Transaction associated with this Transaction. */
                fun transactionId(transactionId: String) =
                    transactionId(JsonField.of(transactionId))

                /**
                 * Sets [Builder.transactionId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.transactionId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun transactionId(transactionId: JsonField<String>) = apply {
                    this.transactionId = transactionId
                }

                /**
                 * A constant representing the object's type. For this resource it will always be
                 * `card_settlement`.
                 */
                fun type(type: Type) = type(JsonField.of(type))

                /**
                 * Sets [Builder.type] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.type] with a well-typed [Type] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun type(type: JsonField<Type>) = apply { this.type = type }

                fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                    this.additionalProperties.clear()
                    putAllAdditionalProperties(additionalProperties)
                }

                fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                    additionalProperties.put(key, value)
                }

                fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun removeAdditionalProperty(key: String) = apply {
                    additionalProperties.remove(key)
                }

                fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                    keys.forEach(::removeAdditionalProperty)
                }

                /**
                 * Returns an immutable instance of [CardSettlement].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .amount()
                 * .cardAuthorization()
                 * .cardPaymentId()
                 * .cashback()
                 * .currency()
                 * .interchange()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCity()
                 * .merchantCountry()
                 * .merchantName()
                 * .merchantPostalCode()
                 * .merchantState()
                 * .network()
                 * .networkIdentifiers()
                 * .pendingTransactionId()
                 * .presentmentAmount()
                 * .presentmentCurrency()
                 * .purchaseDetails()
                 * .schemeFees()
                 * .surcharge()
                 * .transactionId()
                 * .type()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardSettlement =
                    CardSettlement(
                        checkRequired("id", id),
                        checkRequired("amount", amount),
                        checkRequired("cardAuthorization", cardAuthorization),
                        checkRequired("cardPaymentId", cardPaymentId),
                        checkRequired("cashback", cashback),
                        checkRequired("currency", currency),
                        checkRequired("interchange", interchange),
                        checkRequired("merchantAcceptorId", merchantAcceptorId),
                        checkRequired("merchantCategoryCode", merchantCategoryCode),
                        checkRequired("merchantCity", merchantCity),
                        checkRequired("merchantCountry", merchantCountry),
                        checkRequired("merchantName", merchantName),
                        checkRequired("merchantPostalCode", merchantPostalCode),
                        checkRequired("merchantState", merchantState),
                        checkRequired("network", network),
                        checkRequired("networkIdentifiers", networkIdentifiers),
                        checkRequired("pendingTransactionId", pendingTransactionId),
                        checkRequired("presentmentAmount", presentmentAmount),
                        checkRequired("presentmentCurrency", presentmentCurrency),
                        checkRequired("purchaseDetails", purchaseDetails),
                        checkRequired("schemeFees", schemeFees).map { it.toImmutable() },
                        checkRequired("surcharge", surcharge),
                        checkRequired("transactionId", transactionId),
                        checkRequired("type", type),
                        additionalProperties.toMutableMap(),
                    )
            }

            private var validated: Boolean = false

            /**
             * Validates that the types of all values in this object match their expected types
             * recursively.
             *
             * This method is _not_ forwards compatible with new types from the API for existing
             * fields.
             *
             * @throws IncreaseInvalidDataException if any value type in this object doesn't match
             *   its expected type.
             */
            fun validate(): CardSettlement = apply {
                if (validated) {
                    return@apply
                }

                id()
                amount()
                cardAuthorization()
                cardPaymentId()
                cashback().ifPresent { it.validate() }
                currency().validate()
                interchange().ifPresent { it.validate() }
                merchantAcceptorId()
                merchantCategoryCode()
                merchantCity()
                merchantCountry()
                merchantName()
                merchantPostalCode()
                merchantState()
                network().validate()
                networkIdentifiers().validate()
                pendingTransactionId()
                presentmentAmount()
                presentmentCurrency()
                purchaseDetails().ifPresent { it.validate() }
                schemeFees().forEach { it.validate() }
                surcharge().ifPresent { it.validate() }
                transactionId()
                type().validate()
                validated = true
            }

            fun isValid(): Boolean =
                try {
                    validate()
                    true
                } catch (e: IncreaseInvalidDataException) {
                    false
                }

            /**
             * Returns a score indicating how many valid values are contained in this object
             * recursively.
             *
             * Used for best match union deserialization.
             */
            @JvmSynthetic
            internal fun validity(): Int =
                (if (id.asKnown().isPresent) 1 else 0) +
                    (if (amount.asKnown().isPresent) 1 else 0) +
                    (if (cardAuthorization.asKnown().isPresent) 1 else 0) +
                    (if (cardPaymentId.asKnown().isPresent) 1 else 0) +
                    (cashback.asKnown().getOrNull()?.validity() ?: 0) +
                    (currency.asKnown().getOrNull()?.validity() ?: 0) +
                    (interchange.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) +
                    (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantCity.asKnown().isPresent) 1 else 0) +
                    (if (merchantCountry.asKnown().isPresent) 1 else 0) +
                    (if (merchantName.asKnown().isPresent) 1 else 0) +
                    (if (merchantPostalCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantState.asKnown().isPresent) 1 else 0) +
                    (network.asKnown().getOrNull()?.validity() ?: 0) +
                    (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (pendingTransactionId.asKnown().isPresent) 1 else 0) +
                    (if (presentmentAmount.asKnown().isPresent) 1 else 0) +
                    (if (presentmentCurrency.asKnown().isPresent) 1 else 0) +
                    (purchaseDetails.asKnown().getOrNull()?.validity() ?: 0) +
                    (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
                    (surcharge.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (transactionId.asKnown().isPresent) 1 else 0) +
                    (type.asKnown().getOrNull()?.validity() ?: 0)

            /**
             * Cashback earned on this transaction, if eligible. Cashback is paid out in aggregate,
             * monthly.
             */
            class Cashback
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val amount: JsonField<String>,
                private val currency: JsonField<Currency>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("amount")
                    @ExcludeMissing
                    amount: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("currency")
                    @ExcludeMissing
                    currency: JsonField<Currency> = JsonMissing.of(),
                ) : this(amount, currency, mutableMapOf())

                /**
                 * The cashback amount given as a string containing a decimal number. The amount is
                 * a positive number if it will be credited to you (e.g., settlements) and a
                 * negative number if it will be debited (e.g., refunds).
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun amount(): String = amount.getRequired("amount")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /**
                 * Returns the raw JSON value of [amount].
                 *
                 * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<String> = amount

                /**
                 * Returns the raw JSON value of [currency].
                 *
                 * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun _currency(): JsonField<Currency> = currency

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [Cashback].
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .currency()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [Cashback]. */
                class Builder internal constructor() {

                    private var amount: JsonField<String>? = null
                    private var currency: JsonField<Currency>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(cashback: Cashback) = apply {
                        amount = cashback.amount
                        currency = cashback.currency
                        additionalProperties = cashback.additionalProperties.toMutableMap()
                    }

                    /**
                     * The cashback amount given as a string containing a decimal number. The amount
                     * is a positive number if it will be credited to you (e.g., settlements) and a
                     * negative number if it will be debited (e.g., refunds).
                     */
                    fun amount(amount: String) = amount(JsonField.of(amount))

                    /**
                     * Sets [Builder.amount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.amount] with a well-typed [String] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun amount(amount: JsonField<String>) = apply { this.amount = amount }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * Sets [Builder.currency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.currency] with a well-typed [Currency] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [Cashback].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .currency()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): Cashback =
                        Cashback(
                            checkRequired("amount", amount),
                            checkRequired("currency", currency),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Cashback = apply {
                    if (validated) {
                        return@apply
                    }

                    amount()
                    currency().validate()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (amount.asKnown().isPresent) 1 else 0) +
                        (currency.asKnown().getOrNull()?.validity() ?: 0)

                /** The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. */
                class Currency
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** US Dollar (USD) */
                        @JvmField val USD = of("USD")

                        @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                    }

                    /** An enum containing [Currency]'s known values. */
                    enum class Known {
                        /** US Dollar (USD) */
                        USD
                    }

                    /**
                     * An enum containing [Currency]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Currency] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** US Dollar (USD) */
                        USD,
                        /**
                         * An enum member indicating that [Currency] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            USD -> Value.USD
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            USD -> Known.USD
                            else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Currency = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Currency && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Cashback &&
                        amount == other.amount &&
                        currency == other.currency &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(amount, currency, additionalProperties)
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "Cashback{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
            }

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
             * settlement currency.
             */
            class Currency @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** US Dollar (USD) */
                    @JvmField val USD = of("USD")

                    @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                }

                /** An enum containing [Currency]'s known values. */
                enum class Known {
                    /** US Dollar (USD) */
                    USD
                }

                /**
                 * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Currency] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** US Dollar (USD) */
                    USD,
                    /**
                     * An enum member indicating that [Currency] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        USD -> Value.USD
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        USD -> Known.USD
                        else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Currency = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Currency && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** Interchange assessed as a part of this transaction. */
            class Interchange
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val amount: JsonField<String>,
                private val code: JsonField<String>,
                private val currency: JsonField<Currency>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("amount")
                    @ExcludeMissing
                    amount: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("code")
                    @ExcludeMissing
                    code: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("currency")
                    @ExcludeMissing
                    currency: JsonField<Currency> = JsonMissing.of(),
                ) : this(amount, code, currency, mutableMapOf())

                /**
                 * The interchange amount given as a string containing a decimal number in major
                 * units (so e.g., "3.14" for $3.14). The amount is a positive number if it is
                 * credited to Increase (e.g., settlements) and a negative number if it is debited
                 * (e.g., refunds).
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun amount(): String = amount.getRequired("amount")

                /**
                 * The card network specific interchange code.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun code(): Optional<String> = code.getOptional("code")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the interchange
                 * reimbursement.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /**
                 * Returns the raw JSON value of [amount].
                 *
                 * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<String> = amount

                /**
                 * Returns the raw JSON value of [code].
                 *
                 * Unlike [code], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("code") @ExcludeMissing fun _code(): JsonField<String> = code

                /**
                 * Returns the raw JSON value of [currency].
                 *
                 * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun _currency(): JsonField<Currency> = currency

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [Interchange].
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .code()
                     * .currency()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [Interchange]. */
                class Builder internal constructor() {

                    private var amount: JsonField<String>? = null
                    private var code: JsonField<String>? = null
                    private var currency: JsonField<Currency>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(interchange: Interchange) = apply {
                        amount = interchange.amount
                        code = interchange.code
                        currency = interchange.currency
                        additionalProperties = interchange.additionalProperties.toMutableMap()
                    }

                    /**
                     * The interchange amount given as a string containing a decimal number in major
                     * units (so e.g., "3.14" for $3.14). The amount is a positive number if it is
                     * credited to Increase (e.g., settlements) and a negative number if it is
                     * debited (e.g., refunds).
                     */
                    fun amount(amount: String) = amount(JsonField.of(amount))

                    /**
                     * Sets [Builder.amount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.amount] with a well-typed [String] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun amount(amount: JsonField<String>) = apply { this.amount = amount }

                    /** The card network specific interchange code. */
                    fun code(code: String?) = code(JsonField.ofNullable(code))

                    /** Alias for calling [Builder.code] with `code.orElse(null)`. */
                    fun code(code: Optional<String>) = code(code.getOrNull())

                    /**
                     * Sets [Builder.code] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.code] with a well-typed [String] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun code(code: JsonField<String>) = apply { this.code = code }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * interchange reimbursement.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * Sets [Builder.currency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.currency] with a well-typed [Currency] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [Interchange].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .code()
                     * .currency()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): Interchange =
                        Interchange(
                            checkRequired("amount", amount),
                            checkRequired("code", code),
                            checkRequired("currency", currency),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Interchange = apply {
                    if (validated) {
                        return@apply
                    }

                    amount()
                    code()
                    currency().validate()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (amount.asKnown().isPresent) 1 else 0) +
                        (if (code.asKnown().isPresent) 1 else 0) +
                        (currency.asKnown().getOrNull()?.validity() ?: 0)

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the interchange
                 * reimbursement.
                 */
                class Currency
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** US Dollar (USD) */
                        @JvmField val USD = of("USD")

                        @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                    }

                    /** An enum containing [Currency]'s known values. */
                    enum class Known {
                        /** US Dollar (USD) */
                        USD
                    }

                    /**
                     * An enum containing [Currency]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Currency] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** US Dollar (USD) */
                        USD,
                        /**
                         * An enum member indicating that [Currency] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            USD -> Value.USD
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            USD -> Known.USD
                            else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Currency = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Currency && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Interchange &&
                        amount == other.amount &&
                        code == other.code &&
                        currency == other.currency &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(amount, code, currency, additionalProperties)
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "Interchange{amount=$amount, code=$code, currency=$currency, additionalProperties=$additionalProperties}"
            }

            /** The card network on which this transaction was processed. */
            class Network @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** Visa */
                    @JvmField val VISA = of("visa")

                    /** Pulse */
                    @JvmField val PULSE = of("pulse")

                    @JvmStatic fun of(value: String) = Network(JsonField.of(value))
                }

                /** An enum containing [Network]'s known values. */
                enum class Known {
                    /** Visa */
                    VISA,
                    /** Pulse */
                    PULSE,
                }

                /**
                 * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Network] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** Visa */
                    VISA,
                    /** Pulse */
                    PULSE,
                    /**
                     * An enum member indicating that [Network] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        VISA -> Value.VISA
                        PULSE -> Value.PULSE
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        VISA -> Known.VISA
                        PULSE -> Known.PULSE
                        else -> throw IncreaseInvalidDataException("Unknown Network: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Network = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Network && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** Network-specific identifiers for this refund. */
            class NetworkIdentifiers
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val acquirerBusinessId: JsonField<String>,
                private val acquirerReferenceNumber: JsonField<String>,
                private val authorizationIdentificationResponse: JsonField<String>,
                private val transactionId: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("acquirer_business_id")
                    @ExcludeMissing
                    acquirerBusinessId: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("acquirer_reference_number")
                    @ExcludeMissing
                    acquirerReferenceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("authorization_identification_response")
                    @ExcludeMissing
                    authorizationIdentificationResponse: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("transaction_id")
                    @ExcludeMissing
                    transactionId: JsonField<String> = JsonMissing.of(),
                ) : this(
                    acquirerBusinessId,
                    acquirerReferenceNumber,
                    authorizationIdentificationResponse,
                    transactionId,
                    mutableMapOf(),
                )

                /**
                 * A network assigned business ID that identifies the acquirer that processed this
                 * transaction.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun acquirerBusinessId(): String =
                    acquirerBusinessId.getRequired("acquirer_business_id")

                /**
                 * A globally unique identifier for this settlement.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun acquirerReferenceNumber(): String =
                    acquirerReferenceNumber.getRequired("acquirer_reference_number")

                /**
                 * The randomly generated 6-character Authorization Identification Response code
                 * sent back to the acquirer in an approved response.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun authorizationIdentificationResponse(): Optional<String> =
                    authorizationIdentificationResponse.getOptional(
                        "authorization_identification_response"
                    )

                /**
                 * A globally unique transaction identifier provided by the card network, used
                 * across multiple life-cycle requests.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun transactionId(): Optional<String> = transactionId.getOptional("transaction_id")

                /**
                 * Returns the raw JSON value of [acquirerBusinessId].
                 *
                 * Unlike [acquirerBusinessId], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("acquirer_business_id")
                @ExcludeMissing
                fun _acquirerBusinessId(): JsonField<String> = acquirerBusinessId

                /**
                 * Returns the raw JSON value of [acquirerReferenceNumber].
                 *
                 * Unlike [acquirerReferenceNumber], this method doesn't throw if the JSON field has
                 * an unexpected type.
                 */
                @JsonProperty("acquirer_reference_number")
                @ExcludeMissing
                fun _acquirerReferenceNumber(): JsonField<String> = acquirerReferenceNumber

                /**
                 * Returns the raw JSON value of [authorizationIdentificationResponse].
                 *
                 * Unlike [authorizationIdentificationResponse], this method doesn't throw if the
                 * JSON field has an unexpected type.
                 */
                @JsonProperty("authorization_identification_response")
                @ExcludeMissing
                fun _authorizationIdentificationResponse(): JsonField<String> =
                    authorizationIdentificationResponse

                /**
                 * Returns the raw JSON value of [transactionId].
                 *
                 * Unlike [transactionId], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("transaction_id")
                @ExcludeMissing
                fun _transactionId(): JsonField<String> = transactionId

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of
                     * [NetworkIdentifiers].
                     *
                     * The following fields are required:
                     * ```java
                     * .acquirerBusinessId()
                     * .acquirerReferenceNumber()
                     * .authorizationIdentificationResponse()
                     * .transactionId()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [NetworkIdentifiers]. */
                class Builder internal constructor() {

                    private var acquirerBusinessId: JsonField<String>? = null
                    private var acquirerReferenceNumber: JsonField<String>? = null
                    private var authorizationIdentificationResponse: JsonField<String>? = null
                    private var transactionId: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(networkIdentifiers: NetworkIdentifiers) = apply {
                        acquirerBusinessId = networkIdentifiers.acquirerBusinessId
                        acquirerReferenceNumber = networkIdentifiers.acquirerReferenceNumber
                        authorizationIdentificationResponse =
                            networkIdentifiers.authorizationIdentificationResponse
                        transactionId = networkIdentifiers.transactionId
                        additionalProperties =
                            networkIdentifiers.additionalProperties.toMutableMap()
                    }

                    /**
                     * A network assigned business ID that identifies the acquirer that processed
                     * this transaction.
                     */
                    fun acquirerBusinessId(acquirerBusinessId: String) =
                        acquirerBusinessId(JsonField.of(acquirerBusinessId))

                    /**
                     * Sets [Builder.acquirerBusinessId] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.acquirerBusinessId] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun acquirerBusinessId(acquirerBusinessId: JsonField<String>) = apply {
                        this.acquirerBusinessId = acquirerBusinessId
                    }

                    /** A globally unique identifier for this settlement. */
                    fun acquirerReferenceNumber(acquirerReferenceNumber: String) =
                        acquirerReferenceNumber(JsonField.of(acquirerReferenceNumber))

                    /**
                     * Sets [Builder.acquirerReferenceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.acquirerReferenceNumber] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun acquirerReferenceNumber(acquirerReferenceNumber: JsonField<String>) =
                        apply {
                            this.acquirerReferenceNumber = acquirerReferenceNumber
                        }

                    /**
                     * The randomly generated 6-character Authorization Identification Response code
                     * sent back to the acquirer in an approved response.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: String?
                    ) =
                        authorizationIdentificationResponse(
                            JsonField.ofNullable(authorizationIdentificationResponse)
                        )

                    /**
                     * Alias for calling [Builder.authorizationIdentificationResponse] with
                     * `authorizationIdentificationResponse.orElse(null)`.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: Optional<String>
                    ) =
                        authorizationIdentificationResponse(
                            authorizationIdentificationResponse.getOrNull()
                        )

                    /**
                     * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON
                     * value.
                     *
                     * You should usually call [Builder.authorizationIdentificationResponse] with a
                     * well-typed [String] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: JsonField<String>
                    ) = apply {
                        this.authorizationIdentificationResponse =
                            authorizationIdentificationResponse
                    }

                    /**
                     * A globally unique transaction identifier provided by the card network, used
                     * across multiple life-cycle requests.
                     */
                    fun transactionId(transactionId: String?) =
                        transactionId(JsonField.ofNullable(transactionId))

                    /**
                     * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`.
                     */
                    fun transactionId(transactionId: Optional<String>) =
                        transactionId(transactionId.getOrNull())

                    /**
                     * Sets [Builder.transactionId] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.transactionId] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun transactionId(transactionId: JsonField<String>) = apply {
                        this.transactionId = transactionId
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [NetworkIdentifiers].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .acquirerBusinessId()
                     * .acquirerReferenceNumber()
                     * .authorizationIdentificationResponse()
                     * .transactionId()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): NetworkIdentifiers =
                        NetworkIdentifiers(
                            checkRequired("acquirerBusinessId", acquirerBusinessId),
                            checkRequired("acquirerReferenceNumber", acquirerReferenceNumber),
                            checkRequired(
                                "authorizationIdentificationResponse",
                                authorizationIdentificationResponse,
                            ),
                            checkRequired("transactionId", transactionId),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): NetworkIdentifiers = apply {
                    if (validated) {
                        return@apply
                    }

                    acquirerBusinessId()
                    acquirerReferenceNumber()
                    authorizationIdentificationResponse()
                    transactionId()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (acquirerBusinessId.asKnown().isPresent) 1 else 0) +
                        (if (acquirerReferenceNumber.asKnown().isPresent) 1 else 0) +
                        (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) +
                        (if (transactionId.asKnown().isPresent) 1 else 0)

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is NetworkIdentifiers &&
                        acquirerBusinessId == other.acquirerBusinessId &&
                        acquirerReferenceNumber == other.acquirerReferenceNumber &&
                        authorizationIdentificationResponse ==
                            other.authorizationIdentificationResponse &&
                        transactionId == other.transactionId &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        acquirerBusinessId,
                        acquirerReferenceNumber,
                        authorizationIdentificationResponse,
                        transactionId,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "NetworkIdentifiers{acquirerBusinessId=$acquirerBusinessId, acquirerReferenceNumber=$acquirerReferenceNumber, authorizationIdentificationResponse=$authorizationIdentificationResponse, transactionId=$transactionId, additionalProperties=$additionalProperties}"
            }

            /**
             * Additional details about the card purchase, such as tax and industry-specific fields.
             */
            class PurchaseDetails
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val carRental: JsonField<CarRental>,
                private val customerReferenceIdentifier: JsonField<String>,
                private val localTaxAmount: JsonField<Long>,
                private val localTaxCurrency: JsonField<String>,
                private val lodging: JsonField<Lodging>,
                private val nationalTaxAmount: JsonField<Long>,
                private val nationalTaxCurrency: JsonField<String>,
                private val purchaseIdentifier: JsonField<String>,
                private val purchaseIdentifierFormat: JsonField<PurchaseIdentifierFormat>,
                private val travel: JsonField<Travel>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("car_rental")
                    @ExcludeMissing
                    carRental: JsonField<CarRental> = JsonMissing.of(),
                    @JsonProperty("customer_reference_identifier")
                    @ExcludeMissing
                    customerReferenceIdentifier: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("local_tax_amount")
                    @ExcludeMissing
                    localTaxAmount: JsonField<Long> = JsonMissing.of(),
                    @JsonProperty("local_tax_currency")
                    @ExcludeMissing
                    localTaxCurrency: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("lodging")
                    @ExcludeMissing
                    lodging: JsonField<Lodging> = JsonMissing.of(),
                    @JsonProperty("national_tax_amount")
                    @ExcludeMissing
                    nationalTaxAmount: JsonField<Long> = JsonMissing.of(),
                    @JsonProperty("national_tax_currency")
                    @ExcludeMissing
                    nationalTaxCurrency: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("purchase_identifier")
                    @ExcludeMissing
                    purchaseIdentifier: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("purchase_identifier_format")
                    @ExcludeMissing
                    purchaseIdentifierFormat: JsonField<PurchaseIdentifierFormat> =
                        JsonMissing.of(),
                    @JsonProperty("travel")
                    @ExcludeMissing
                    travel: JsonField<Travel> = JsonMissing.of(),
                ) : this(
                    carRental,
                    customerReferenceIdentifier,
                    localTaxAmount,
                    localTaxCurrency,
                    lodging,
                    nationalTaxAmount,
                    nationalTaxCurrency,
                    purchaseIdentifier,
                    purchaseIdentifierFormat,
                    travel,
                    mutableMapOf(),
                )

                /**
                 * Fields specific to car rentals.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun carRental(): Optional<CarRental> = carRental.getOptional("car_rental")

                /**
                 * An identifier from the merchant for the customer or consumer.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun customerReferenceIdentifier(): Optional<String> =
                    customerReferenceIdentifier.getOptional("customer_reference_identifier")

                /**
                 * The state or provincial tax amount in minor units.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun localTaxAmount(): Optional<Long> =
                    localTaxAmount.getOptional("local_tax_amount")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax
                 * assessed.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun localTaxCurrency(): Optional<String> =
                    localTaxCurrency.getOptional("local_tax_currency")

                /**
                 * Fields specific to lodging.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun lodging(): Optional<Lodging> = lodging.getOptional("lodging")

                /**
                 * The national tax amount in minor units.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun nationalTaxAmount(): Optional<Long> =
                    nationalTaxAmount.getOptional("national_tax_amount")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax
                 * assessed.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun nationalTaxCurrency(): Optional<String> =
                    nationalTaxCurrency.getOptional("national_tax_currency")

                /**
                 * An identifier from the merchant for the purchase to the issuer and cardholder.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun purchaseIdentifier(): Optional<String> =
                    purchaseIdentifier.getOptional("purchase_identifier")

                /**
                 * The format of the purchase identifier.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun purchaseIdentifierFormat(): Optional<PurchaseIdentifierFormat> =
                    purchaseIdentifierFormat.getOptional("purchase_identifier_format")

                /**
                 * Fields specific to travel.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun travel(): Optional<Travel> = travel.getOptional("travel")

                /**
                 * Returns the raw JSON value of [carRental].
                 *
                 * Unlike [carRental], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("car_rental")
                @ExcludeMissing
                fun _carRental(): JsonField<CarRental> = carRental

                /**
                 * Returns the raw JSON value of [customerReferenceIdentifier].
                 *
                 * Unlike [customerReferenceIdentifier], this method doesn't throw if the JSON field
                 * has an unexpected type.
                 */
                @JsonProperty("customer_reference_identifier")
                @ExcludeMissing
                fun _customerReferenceIdentifier(): JsonField<String> = customerReferenceIdentifier

                /**
                 * Returns the raw JSON value of [localTaxAmount].
                 *
                 * Unlike [localTaxAmount], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("local_tax_amount")
                @ExcludeMissing
                fun _localTaxAmount(): JsonField<Long> = localTaxAmount

                /**
                 * Returns the raw JSON value of [localTaxCurrency].
                 *
                 * Unlike [localTaxCurrency], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("local_tax_currency")
                @ExcludeMissing
                fun _localTaxCurrency(): JsonField<String> = localTaxCurrency

                /**
                 * Returns the raw JSON value of [lodging].
                 *
                 * Unlike [lodging], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("lodging")
                @ExcludeMissing
                fun _lodging(): JsonField<Lodging> = lodging

                /**
                 * Returns the raw JSON value of [nationalTaxAmount].
                 *
                 * Unlike [nationalTaxAmount], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("national_tax_amount")
                @ExcludeMissing
                fun _nationalTaxAmount(): JsonField<Long> = nationalTaxAmount

                /**
                 * Returns the raw JSON value of [nationalTaxCurrency].
                 *
                 * Unlike [nationalTaxCurrency], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("national_tax_currency")
                @ExcludeMissing
                fun _nationalTaxCurrency(): JsonField<String> = nationalTaxCurrency

                /**
                 * Returns the raw JSON value of [purchaseIdentifier].
                 *
                 * Unlike [purchaseIdentifier], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("purchase_identifier")
                @ExcludeMissing
                fun _purchaseIdentifier(): JsonField<String> = purchaseIdentifier

                /**
                 * Returns the raw JSON value of [purchaseIdentifierFormat].
                 *
                 * Unlike [purchaseIdentifierFormat], this method doesn't throw if the JSON field
                 * has an unexpected type.
                 */
                @JsonProperty("purchase_identifier_format")
                @ExcludeMissing
                fun _purchaseIdentifierFormat(): JsonField<PurchaseIdentifierFormat> =
                    purchaseIdentifierFormat

                /**
                 * Returns the raw JSON value of [travel].
                 *
                 * Unlike [travel], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("travel") @ExcludeMissing fun _travel(): JsonField<Travel> = travel

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [PurchaseDetails].
                     *
                     * The following fields are required:
                     * ```java
                     * .carRental()
                     * .customerReferenceIdentifier()
                     * .localTaxAmount()
                     * .localTaxCurrency()
                     * .lodging()
                     * .nationalTaxAmount()
                     * .nationalTaxCurrency()
                     * .purchaseIdentifier()
                     * .purchaseIdentifierFormat()
                     * .travel()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [PurchaseDetails]. */
                class Builder internal constructor() {

                    private var carRental: JsonField<CarRental>? = null
                    private var customerReferenceIdentifier: JsonField<String>? = null
                    private var localTaxAmount: JsonField<Long>? = null
                    private var localTaxCurrency: JsonField<String>? = null
                    private var lodging: JsonField<Lodging>? = null
                    private var nationalTaxAmount: JsonField<Long>? = null
                    private var nationalTaxCurrency: JsonField<String>? = null
                    private var purchaseIdentifier: JsonField<String>? = null
                    private var purchaseIdentifierFormat: JsonField<PurchaseIdentifierFormat>? =
                        null
                    private var travel: JsonField<Travel>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(purchaseDetails: PurchaseDetails) = apply {
                        carRental = purchaseDetails.carRental
                        customerReferenceIdentifier = purchaseDetails.customerReferenceIdentifier
                        localTaxAmount = purchaseDetails.localTaxAmount
                        localTaxCurrency = purchaseDetails.localTaxCurrency
                        lodging = purchaseDetails.lodging
                        nationalTaxAmount = purchaseDetails.nationalTaxAmount
                        nationalTaxCurrency = purchaseDetails.nationalTaxCurrency
                        purchaseIdentifier = purchaseDetails.purchaseIdentifier
                        purchaseIdentifierFormat = purchaseDetails.purchaseIdentifierFormat
                        travel = purchaseDetails.travel
                        additionalProperties = purchaseDetails.additionalProperties.toMutableMap()
                    }

                    /** Fields specific to car rentals. */
                    fun carRental(carRental: CarRental?) =
                        carRental(JsonField.ofNullable(carRental))

                    /** Alias for calling [Builder.carRental] with `carRental.orElse(null)`. */
                    fun carRental(carRental: Optional<CarRental>) = carRental(carRental.getOrNull())

                    /**
                     * Sets [Builder.carRental] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.carRental] with a well-typed [CarRental]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun carRental(carRental: JsonField<CarRental>) = apply {
                        this.carRental = carRental
                    }

                    /** An identifier from the merchant for the customer or consumer. */
                    fun customerReferenceIdentifier(customerReferenceIdentifier: String?) =
                        customerReferenceIdentifier(
                            JsonField.ofNullable(customerReferenceIdentifier)
                        )

                    /**
                     * Alias for calling [Builder.customerReferenceIdentifier] with
                     * `customerReferenceIdentifier.orElse(null)`.
                     */
                    fun customerReferenceIdentifier(customerReferenceIdentifier: Optional<String>) =
                        customerReferenceIdentifier(customerReferenceIdentifier.getOrNull())

                    /**
                     * Sets [Builder.customerReferenceIdentifier] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.customerReferenceIdentifier] with a
                     * well-typed [String] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun customerReferenceIdentifier(
                        customerReferenceIdentifier: JsonField<String>
                    ) = apply { this.customerReferenceIdentifier = customerReferenceIdentifier }

                    /** The state or provincial tax amount in minor units. */
                    fun localTaxAmount(localTaxAmount: Long?) =
                        localTaxAmount(JsonField.ofNullable(localTaxAmount))

                    /**
                     * Alias for [Builder.localTaxAmount].
                     *
                     * This unboxed primitive overload exists for backwards compatibility.
                     */
                    fun localTaxAmount(localTaxAmount: Long) =
                        localTaxAmount(localTaxAmount as Long?)

                    /**
                     * Alias for calling [Builder.localTaxAmount] with
                     * `localTaxAmount.orElse(null)`.
                     */
                    fun localTaxAmount(localTaxAmount: Optional<Long>) =
                        localTaxAmount(localTaxAmount.getOrNull())

                    /**
                     * Sets [Builder.localTaxAmount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.localTaxAmount] with a well-typed [Long]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun localTaxAmount(localTaxAmount: JsonField<Long>) = apply {
                        this.localTaxAmount = localTaxAmount
                    }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax
                     * assessed.
                     */
                    fun localTaxCurrency(localTaxCurrency: String?) =
                        localTaxCurrency(JsonField.ofNullable(localTaxCurrency))

                    /**
                     * Alias for calling [Builder.localTaxCurrency] with
                     * `localTaxCurrency.orElse(null)`.
                     */
                    fun localTaxCurrency(localTaxCurrency: Optional<String>) =
                        localTaxCurrency(localTaxCurrency.getOrNull())

                    /**
                     * Sets [Builder.localTaxCurrency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.localTaxCurrency] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun localTaxCurrency(localTaxCurrency: JsonField<String>) = apply {
                        this.localTaxCurrency = localTaxCurrency
                    }

                    /** Fields specific to lodging. */
                    fun lodging(lodging: Lodging?) = lodging(JsonField.ofNullable(lodging))

                    /** Alias for calling [Builder.lodging] with `lodging.orElse(null)`. */
                    fun lodging(lodging: Optional<Lodging>) = lodging(lodging.getOrNull())

                    /**
                     * Sets [Builder.lodging] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.lodging] with a well-typed [Lodging] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun lodging(lodging: JsonField<Lodging>) = apply { this.lodging = lodging }

                    /** The national tax amount in minor units. */
                    fun nationalTaxAmount(nationalTaxAmount: Long?) =
                        nationalTaxAmount(JsonField.ofNullable(nationalTaxAmount))

                    /**
                     * Alias for [Builder.nationalTaxAmount].
                     *
                     * This unboxed primitive overload exists for backwards compatibility.
                     */
                    fun nationalTaxAmount(nationalTaxAmount: Long) =
                        nationalTaxAmount(nationalTaxAmount as Long?)

                    /**
                     * Alias for calling [Builder.nationalTaxAmount] with
                     * `nationalTaxAmount.orElse(null)`.
                     */
                    fun nationalTaxAmount(nationalTaxAmount: Optional<Long>) =
                        nationalTaxAmount(nationalTaxAmount.getOrNull())

                    /**
                     * Sets [Builder.nationalTaxAmount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.nationalTaxAmount] with a well-typed [Long]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun nationalTaxAmount(nationalTaxAmount: JsonField<Long>) = apply {
                        this.nationalTaxAmount = nationalTaxAmount
                    }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax
                     * assessed.
                     */
                    fun nationalTaxCurrency(nationalTaxCurrency: String?) =
                        nationalTaxCurrency(JsonField.ofNullable(nationalTaxCurrency))

                    /**
                     * Alias for calling [Builder.nationalTaxCurrency] with
                     * `nationalTaxCurrency.orElse(null)`.
                     */
                    fun nationalTaxCurrency(nationalTaxCurrency: Optional<String>) =
                        nationalTaxCurrency(nationalTaxCurrency.getOrNull())

                    /**
                     * Sets [Builder.nationalTaxCurrency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.nationalTaxCurrency] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun nationalTaxCurrency(nationalTaxCurrency: JsonField<String>) = apply {
                        this.nationalTaxCurrency = nationalTaxCurrency
                    }

                    /**
                     * An identifier from the merchant for the purchase to the issuer and
                     * cardholder.
                     */
                    fun purchaseIdentifier(purchaseIdentifier: String?) =
                        purchaseIdentifier(JsonField.ofNullable(purchaseIdentifier))

                    /**
                     * Alias for calling [Builder.purchaseIdentifier] with
                     * `purchaseIdentifier.orElse(null)`.
                     */
                    fun purchaseIdentifier(purchaseIdentifier: Optional<String>) =
                        purchaseIdentifier(purchaseIdentifier.getOrNull())

                    /**
                     * Sets [Builder.purchaseIdentifier] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.purchaseIdentifier] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun purchaseIdentifier(purchaseIdentifier: JsonField<String>) = apply {
                        this.purchaseIdentifier = purchaseIdentifier
                    }

                    /** The format of the purchase identifier. */
                    fun purchaseIdentifierFormat(
                        purchaseIdentifierFormat: PurchaseIdentifierFormat?
                    ) = purchaseIdentifierFormat(JsonField.ofNullable(purchaseIdentifierFormat))

                    /**
                     * Alias for calling [Builder.purchaseIdentifierFormat] with
                     * `purchaseIdentifierFormat.orElse(null)`.
                     */
                    fun purchaseIdentifierFormat(
                        purchaseIdentifierFormat: Optional<PurchaseIdentifierFormat>
                    ) = purchaseIdentifierFormat(purchaseIdentifierFormat.getOrNull())

                    /**
                     * Sets [Builder.purchaseIdentifierFormat] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.purchaseIdentifierFormat] with a well-typed
                     * [PurchaseIdentifierFormat] value instead. This method is primarily for
                     * setting the field to an undocumented or not yet supported value.
                     */
                    fun purchaseIdentifierFormat(
                        purchaseIdentifierFormat: JsonField<PurchaseIdentifierFormat>
                    ) = apply { this.purchaseIdentifierFormat = purchaseIdentifierFormat }

                    /** Fields specific to travel. */
                    fun travel(travel: Travel?) = travel(JsonField.ofNullable(travel))

                    /** Alias for calling [Builder.travel] with `travel.orElse(null)`. */
                    fun travel(travel: Optional<Travel>) = travel(travel.getOrNull())

                    /**
                     * Sets [Builder.travel] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.travel] with a well-typed [Travel] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun travel(travel: JsonField<Travel>) = apply { this.travel = travel }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [PurchaseDetails].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .carRental()
                     * .customerReferenceIdentifier()
                     * .localTaxAmount()
                     * .localTaxCurrency()
                     * .lodging()
                     * .nationalTaxAmount()
                     * .nationalTaxCurrency()
                     * .purchaseIdentifier()
                     * .purchaseIdentifierFormat()
                     * .travel()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): PurchaseDetails =
                        PurchaseDetails(
                            checkRequired("carRental", carRental),
                            checkRequired(
                                "customerReferenceIdentifier",
                                customerReferenceIdentifier,
                            ),
                            checkRequired("localTaxAmount", localTaxAmount),
                            checkRequired("localTaxCurrency", localTaxCurrency),
                            checkRequired("lodging", lodging),
                            checkRequired("nationalTaxAmount", nationalTaxAmount),
                            checkRequired("nationalTaxCurrency", nationalTaxCurrency),
                            checkRequired("purchaseIdentifier", purchaseIdentifier),
                            checkRequired("purchaseIdentifierFormat", purchaseIdentifierFormat),
                            checkRequired("travel", travel),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): PurchaseDetails = apply {
                    if (validated) {
                        return@apply
                    }

                    carRental().ifPresent { it.validate() }
                    customerReferenceIdentifier()
                    localTaxAmount()
                    localTaxCurrency()
                    lodging().ifPresent { it.validate() }
                    nationalTaxAmount()
                    nationalTaxCurrency()
                    purchaseIdentifier()
                    purchaseIdentifierFormat().ifPresent { it.validate() }
                    travel().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (carRental.asKnown().getOrNull()?.validity() ?: 0) +
                        (if (customerReferenceIdentifier.asKnown().isPresent) 1 else 0) +
                        (if (localTaxAmount.asKnown().isPresent) 1 else 0) +
                        (if (localTaxCurrency.asKnown().isPresent) 1 else 0) +
                        (lodging.asKnown().getOrNull()?.validity() ?: 0) +
                        (if (nationalTaxAmount.asKnown().isPresent) 1 else 0) +
                        (if (nationalTaxCurrency.asKnown().isPresent) 1 else 0) +
                        (if (purchaseIdentifier.asKnown().isPresent) 1 else 0) +
                        (purchaseIdentifierFormat.asKnown().getOrNull()?.validity() ?: 0) +
                        (travel.asKnown().getOrNull()?.validity() ?: 0)

                /** Fields specific to car rentals. */
                class CarRental
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val carClassCode: JsonField<String>,
                    private val checkoutDate: JsonField<LocalDate>,
                    private val dailyRentalRateAmount: JsonField<Long>,
                    private val dailyRentalRateCurrency: JsonField<String>,
                    private val daysRented: JsonField<Long>,
                    private val extraCharges: JsonField<ExtraCharges>,
                    private val fuelChargesAmount: JsonField<Long>,
                    private val fuelChargesCurrency: JsonField<String>,
                    private val insuranceChargesAmount: JsonField<Long>,
                    private val insuranceChargesCurrency: JsonField<String>,
                    private val noShowIndicator: JsonField<NoShowIndicator>,
                    private val oneWayDropOffChargesAmount: JsonField<Long>,
                    private val oneWayDropOffChargesCurrency: JsonField<String>,
                    private val renterName: JsonField<String>,
                    private val weeklyRentalRateAmount: JsonField<Long>,
                    private val weeklyRentalRateCurrency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("car_class_code")
                        @ExcludeMissing
                        carClassCode: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("checkout_date")
                        @ExcludeMissing
                        checkoutDate: JsonField<LocalDate> = JsonMissing.of(),
                        @JsonProperty("daily_rental_rate_amount")
                        @ExcludeMissing
                        dailyRentalRateAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("daily_rental_rate_currency")
                        @ExcludeMissing
                        dailyRentalRateCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("days_rented")
                        @ExcludeMissing
                        daysRented: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("extra_charges")
                        @ExcludeMissing
                        extraCharges: JsonField<ExtraCharges> = JsonMissing.of(),
                        @JsonProperty("fuel_charges_amount")
                        @ExcludeMissing
                        fuelChargesAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("fuel_charges_currency")
                        @ExcludeMissing
                        fuelChargesCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("insurance_charges_amount")
                        @ExcludeMissing
                        insuranceChargesAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("insurance_charges_currency")
                        @ExcludeMissing
                        insuranceChargesCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("no_show_indicator")
                        @ExcludeMissing
                        noShowIndicator: JsonField<NoShowIndicator> = JsonMissing.of(),
                        @JsonProperty("one_way_drop_off_charges_amount")
                        @ExcludeMissing
                        oneWayDropOffChargesAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("one_way_drop_off_charges_currency")
                        @ExcludeMissing
                        oneWayDropOffChargesCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("renter_name")
                        @ExcludeMissing
                        renterName: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("weekly_rental_rate_amount")
                        @ExcludeMissing
                        weeklyRentalRateAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("weekly_rental_rate_currency")
                        @ExcludeMissing
                        weeklyRentalRateCurrency: JsonField<String> = JsonMissing.of(),
                    ) : this(
                        carClassCode,
                        checkoutDate,
                        dailyRentalRateAmount,
                        dailyRentalRateCurrency,
                        daysRented,
                        extraCharges,
                        fuelChargesAmount,
                        fuelChargesCurrency,
                        insuranceChargesAmount,
                        insuranceChargesCurrency,
                        noShowIndicator,
                        oneWayDropOffChargesAmount,
                        oneWayDropOffChargesCurrency,
                        renterName,
                        weeklyRentalRateAmount,
                        weeklyRentalRateCurrency,
                        mutableMapOf(),
                    )

                    /**
                     * Code indicating the vehicle's class.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun carClassCode(): Optional<String> =
                        carClassCode.getOptional("car_class_code")

                    /**
                     * Date the customer picked up the car or, in the case of a no-show or pre-pay
                     * transaction, the scheduled pick up date.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun checkoutDate(): Optional<LocalDate> =
                        checkoutDate.getOptional("checkout_date")

                    /**
                     * Daily rate being charged for the vehicle.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun dailyRentalRateAmount(): Optional<Long> =
                        dailyRentalRateAmount.getOptional("daily_rental_rate_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily
                     * rental rate.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun dailyRentalRateCurrency(): Optional<String> =
                        dailyRentalRateCurrency.getOptional("daily_rental_rate_currency")

                    /**
                     * Number of days the vehicle was rented.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun daysRented(): Optional<Long> = daysRented.getOptional("days_rented")

                    /**
                     * Additional charges (gas, late fee, etc.) being billed.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun extraCharges(): Optional<ExtraCharges> =
                        extraCharges.getOptional("extra_charges")

                    /**
                     * Fuel charges for the vehicle.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun fuelChargesAmount(): Optional<Long> =
                        fuelChargesAmount.getOptional("fuel_charges_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel
                     * charges assessed.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun fuelChargesCurrency(): Optional<String> =
                        fuelChargesCurrency.getOptional("fuel_charges_currency")

                    /**
                     * Any insurance being charged for the vehicle.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun insuranceChargesAmount(): Optional<Long> =
                        insuranceChargesAmount.getOptional("insurance_charges_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the insurance
                     * charges assessed.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun insuranceChargesCurrency(): Optional<String> =
                        insuranceChargesCurrency.getOptional("insurance_charges_currency")

                    /**
                     * An indicator that the cardholder is being billed for a reserved vehicle that
                     * was not actually rented (that is, a "no-show" charge).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun noShowIndicator(): Optional<NoShowIndicator> =
                        noShowIndicator.getOptional("no_show_indicator")

                    /**
                     * Charges for returning the vehicle at a different location than where it was
                     * picked up.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun oneWayDropOffChargesAmount(): Optional<Long> =
                        oneWayDropOffChargesAmount.getOptional("one_way_drop_off_charges_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the one-way
                     * drop-off charges assessed.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun oneWayDropOffChargesCurrency(): Optional<String> =
                        oneWayDropOffChargesCurrency.getOptional(
                            "one_way_drop_off_charges_currency"
                        )

                    /**
                     * Name of the person renting the vehicle.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun renterName(): Optional<String> = renterName.getOptional("renter_name")

                    /**
                     * Weekly rate being charged for the vehicle.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun weeklyRentalRateAmount(): Optional<Long> =
                        weeklyRentalRateAmount.getOptional("weekly_rental_rate_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the weekly
                     * rental rate.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun weeklyRentalRateCurrency(): Optional<String> =
                        weeklyRentalRateCurrency.getOptional("weekly_rental_rate_currency")

                    /**
                     * Returns the raw JSON value of [carClassCode].
                     *
                     * Unlike [carClassCode], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("car_class_code")
                    @ExcludeMissing
                    fun _carClassCode(): JsonField<String> = carClassCode

                    /**
                     * Returns the raw JSON value of [checkoutDate].
                     *
                     * Unlike [checkoutDate], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("checkout_date")
                    @ExcludeMissing
                    fun _checkoutDate(): JsonField<LocalDate> = checkoutDate

                    /**
                     * Returns the raw JSON value of [dailyRentalRateAmount].
                     *
                     * Unlike [dailyRentalRateAmount], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("daily_rental_rate_amount")
                    @ExcludeMissing
                    fun _dailyRentalRateAmount(): JsonField<Long> = dailyRentalRateAmount

                    /**
                     * Returns the raw JSON value of [dailyRentalRateCurrency].
                     *
                     * Unlike [dailyRentalRateCurrency], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("daily_rental_rate_currency")
                    @ExcludeMissing
                    fun _dailyRentalRateCurrency(): JsonField<String> = dailyRentalRateCurrency

                    /**
                     * Returns the raw JSON value of [daysRented].
                     *
                     * Unlike [daysRented], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("days_rented")
                    @ExcludeMissing
                    fun _daysRented(): JsonField<Long> = daysRented

                    /**
                     * Returns the raw JSON value of [extraCharges].
                     *
                     * Unlike [extraCharges], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("extra_charges")
                    @ExcludeMissing
                    fun _extraCharges(): JsonField<ExtraCharges> = extraCharges

                    /**
                     * Returns the raw JSON value of [fuelChargesAmount].
                     *
                     * Unlike [fuelChargesAmount], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("fuel_charges_amount")
                    @ExcludeMissing
                    fun _fuelChargesAmount(): JsonField<Long> = fuelChargesAmount

                    /**
                     * Returns the raw JSON value of [fuelChargesCurrency].
                     *
                     * Unlike [fuelChargesCurrency], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("fuel_charges_currency")
                    @ExcludeMissing
                    fun _fuelChargesCurrency(): JsonField<String> = fuelChargesCurrency

                    /**
                     * Returns the raw JSON value of [insuranceChargesAmount].
                     *
                     * Unlike [insuranceChargesAmount], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("insurance_charges_amount")
                    @ExcludeMissing
                    fun _insuranceChargesAmount(): JsonField<Long> = insuranceChargesAmount

                    /**
                     * Returns the raw JSON value of [insuranceChargesCurrency].
                     *
                     * Unlike [insuranceChargesCurrency], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("insurance_charges_currency")
                    @ExcludeMissing
                    fun _insuranceChargesCurrency(): JsonField<String> = insuranceChargesCurrency

                    /**
                     * Returns the raw JSON value of [noShowIndicator].
                     *
                     * Unlike [noShowIndicator], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("no_show_indicator")
                    @ExcludeMissing
                    fun _noShowIndicator(): JsonField<NoShowIndicator> = noShowIndicator

                    /**
                     * Returns the raw JSON value of [oneWayDropOffChargesAmount].
                     *
                     * Unlike [oneWayDropOffChargesAmount], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("one_way_drop_off_charges_amount")
                    @ExcludeMissing
                    fun _oneWayDropOffChargesAmount(): JsonField<Long> = oneWayDropOffChargesAmount

                    /**
                     * Returns the raw JSON value of [oneWayDropOffChargesCurrency].
                     *
                     * Unlike [oneWayDropOffChargesCurrency], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("one_way_drop_off_charges_currency")
                    @ExcludeMissing
                    fun _oneWayDropOffChargesCurrency(): JsonField<String> =
                        oneWayDropOffChargesCurrency

                    /**
                     * Returns the raw JSON value of [renterName].
                     *
                     * Unlike [renterName], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("renter_name")
                    @ExcludeMissing
                    fun _renterName(): JsonField<String> = renterName

                    /**
                     * Returns the raw JSON value of [weeklyRentalRateAmount].
                     *
                     * Unlike [weeklyRentalRateAmount], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("weekly_rental_rate_amount")
                    @ExcludeMissing
                    fun _weeklyRentalRateAmount(): JsonField<Long> = weeklyRentalRateAmount

                    /**
                     * Returns the raw JSON value of [weeklyRentalRateCurrency].
                     *
                     * Unlike [weeklyRentalRateCurrency], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("weekly_rental_rate_currency")
                    @ExcludeMissing
                    fun _weeklyRentalRateCurrency(): JsonField<String> = weeklyRentalRateCurrency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [CarRental].
                         *
                         * The following fields are required:
                         * ```java
                         * .carClassCode()
                         * .checkoutDate()
                         * .dailyRentalRateAmount()
                         * .dailyRentalRateCurrency()
                         * .daysRented()
                         * .extraCharges()
                         * .fuelChargesAmount()
                         * .fuelChargesCurrency()
                         * .insuranceChargesAmount()
                         * .insuranceChargesCurrency()
                         * .noShowIndicator()
                         * .oneWayDropOffChargesAmount()
                         * .oneWayDropOffChargesCurrency()
                         * .renterName()
                         * .weeklyRentalRateAmount()
                         * .weeklyRentalRateCurrency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CarRental]. */
                    class Builder internal constructor() {

                        private var carClassCode: JsonField<String>? = null
                        private var checkoutDate: JsonField<LocalDate>? = null
                        private var dailyRentalRateAmount: JsonField<Long>? = null
                        private var dailyRentalRateCurrency: JsonField<String>? = null
                        private var daysRented: JsonField<Long>? = null
                        private var extraCharges: JsonField<ExtraCharges>? = null
                        private var fuelChargesAmount: JsonField<Long>? = null
                        private var fuelChargesCurrency: JsonField<String>? = null
                        private var insuranceChargesAmount: JsonField<Long>? = null
                        private var insuranceChargesCurrency: JsonField<String>? = null
                        private var noShowIndicator: JsonField<NoShowIndicator>? = null
                        private var oneWayDropOffChargesAmount: JsonField<Long>? = null
                        private var oneWayDropOffChargesCurrency: JsonField<String>? = null
                        private var renterName: JsonField<String>? = null
                        private var weeklyRentalRateAmount: JsonField<Long>? = null
                        private var weeklyRentalRateCurrency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(carRental: CarRental) = apply {
                            carClassCode = carRental.carClassCode
                            checkoutDate = carRental.checkoutDate
                            dailyRentalRateAmount = carRental.dailyRentalRateAmount
                            dailyRentalRateCurrency = carRental.dailyRentalRateCurrency
                            daysRented = carRental.daysRented
                            extraCharges = carRental.extraCharges
                            fuelChargesAmount = carRental.fuelChargesAmount
                            fuelChargesCurrency = carRental.fuelChargesCurrency
                            insuranceChargesAmount = carRental.insuranceChargesAmount
                            insuranceChargesCurrency = carRental.insuranceChargesCurrency
                            noShowIndicator = carRental.noShowIndicator
                            oneWayDropOffChargesAmount = carRental.oneWayDropOffChargesAmount
                            oneWayDropOffChargesCurrency = carRental.oneWayDropOffChargesCurrency
                            renterName = carRental.renterName
                            weeklyRentalRateAmount = carRental.weeklyRentalRateAmount
                            weeklyRentalRateCurrency = carRental.weeklyRentalRateCurrency
                            additionalProperties = carRental.additionalProperties.toMutableMap()
                        }

                        /** Code indicating the vehicle's class. */
                        fun carClassCode(carClassCode: String?) =
                            carClassCode(JsonField.ofNullable(carClassCode))

                        /**
                         * Alias for calling [Builder.carClassCode] with
                         * `carClassCode.orElse(null)`.
                         */
                        fun carClassCode(carClassCode: Optional<String>) =
                            carClassCode(carClassCode.getOrNull())

                        /**
                         * Sets [Builder.carClassCode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.carClassCode] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun carClassCode(carClassCode: JsonField<String>) = apply {
                            this.carClassCode = carClassCode
                        }

                        /**
                         * Date the customer picked up the car or, in the case of a no-show or
                         * pre-pay transaction, the scheduled pick up date.
                         */
                        fun checkoutDate(checkoutDate: LocalDate?) =
                            checkoutDate(JsonField.ofNullable(checkoutDate))

                        /**
                         * Alias for calling [Builder.checkoutDate] with
                         * `checkoutDate.orElse(null)`.
                         */
                        fun checkoutDate(checkoutDate: Optional<LocalDate>) =
                            checkoutDate(checkoutDate.getOrNull())

                        /**
                         * Sets [Builder.checkoutDate] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.checkoutDate] with a well-typed
                         * [LocalDate] value instead. This method is primarily for setting the field
                         * to an undocumented or not yet supported value.
                         */
                        fun checkoutDate(checkoutDate: JsonField<LocalDate>) = apply {
                            this.checkoutDate = checkoutDate
                        }

                        /** Daily rate being charged for the vehicle. */
                        fun dailyRentalRateAmount(dailyRentalRateAmount: Long?) =
                            dailyRentalRateAmount(JsonField.ofNullable(dailyRentalRateAmount))

                        /**
                         * Alias for [Builder.dailyRentalRateAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun dailyRentalRateAmount(dailyRentalRateAmount: Long) =
                            dailyRentalRateAmount(dailyRentalRateAmount as Long?)

                        /**
                         * Alias for calling [Builder.dailyRentalRateAmount] with
                         * `dailyRentalRateAmount.orElse(null)`.
                         */
                        fun dailyRentalRateAmount(dailyRentalRateAmount: Optional<Long>) =
                            dailyRentalRateAmount(dailyRentalRateAmount.getOrNull())

                        /**
                         * Sets [Builder.dailyRentalRateAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.dailyRentalRateAmount] with a well-typed
                         * [Long] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun dailyRentalRateAmount(dailyRentalRateAmount: JsonField<Long>) = apply {
                            this.dailyRentalRateAmount = dailyRentalRateAmount
                        }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily
                         * rental rate.
                         */
                        fun dailyRentalRateCurrency(dailyRentalRateCurrency: String?) =
                            dailyRentalRateCurrency(JsonField.ofNullable(dailyRentalRateCurrency))

                        /**
                         * Alias for calling [Builder.dailyRentalRateCurrency] with
                         * `dailyRentalRateCurrency.orElse(null)`.
                         */
                        fun dailyRentalRateCurrency(dailyRentalRateCurrency: Optional<String>) =
                            dailyRentalRateCurrency(dailyRentalRateCurrency.getOrNull())

                        /**
                         * Sets [Builder.dailyRentalRateCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.dailyRentalRateCurrency] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun dailyRentalRateCurrency(dailyRentalRateCurrency: JsonField<String>) =
                            apply {
                                this.dailyRentalRateCurrency = dailyRentalRateCurrency
                            }

                        /** Number of days the vehicle was rented. */
                        fun daysRented(daysRented: Long?) =
                            daysRented(JsonField.ofNullable(daysRented))

                        /**
                         * Alias for [Builder.daysRented].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun daysRented(daysRented: Long) = daysRented(daysRented as Long?)

                        /**
                         * Alias for calling [Builder.daysRented] with `daysRented.orElse(null)`.
                         */
                        fun daysRented(daysRented: Optional<Long>) =
                            daysRented(daysRented.getOrNull())

                        /**
                         * Sets [Builder.daysRented] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.daysRented] with a well-typed [Long]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun daysRented(daysRented: JsonField<Long>) = apply {
                            this.daysRented = daysRented
                        }

                        /** Additional charges (gas, late fee, etc.) being billed. */
                        fun extraCharges(extraCharges: ExtraCharges?) =
                            extraCharges(JsonField.ofNullable(extraCharges))

                        /**
                         * Alias for calling [Builder.extraCharges] with
                         * `extraCharges.orElse(null)`.
                         */
                        fun extraCharges(extraCharges: Optional<ExtraCharges>) =
                            extraCharges(extraCharges.getOrNull())

                        /**
                         * Sets [Builder.extraCharges] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.extraCharges] with a well-typed
                         * [ExtraCharges] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun extraCharges(extraCharges: JsonField<ExtraCharges>) = apply {
                            this.extraCharges = extraCharges
                        }

                        /** Fuel charges for the vehicle. */
                        fun fuelChargesAmount(fuelChargesAmount: Long?) =
                            fuelChargesAmount(JsonField.ofNullable(fuelChargesAmount))

                        /**
                         * Alias for [Builder.fuelChargesAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun fuelChargesAmount(fuelChargesAmount: Long) =
                            fuelChargesAmount(fuelChargesAmount as Long?)

                        /**
                         * Alias for calling [Builder.fuelChargesAmount] with
                         * `fuelChargesAmount.orElse(null)`.
                         */
                        fun fuelChargesAmount(fuelChargesAmount: Optional<Long>) =
                            fuelChargesAmount(fuelChargesAmount.getOrNull())

                        /**
                         * Sets [Builder.fuelChargesAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.fuelChargesAmount] with a well-typed
                         * [Long] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun fuelChargesAmount(fuelChargesAmount: JsonField<Long>) = apply {
                            this.fuelChargesAmount = fuelChargesAmount
                        }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel
                         * charges assessed.
                         */
                        fun fuelChargesCurrency(fuelChargesCurrency: String?) =
                            fuelChargesCurrency(JsonField.ofNullable(fuelChargesCurrency))

                        /**
                         * Alias for calling [Builder.fuelChargesCurrency] with
                         * `fuelChargesCurrency.orElse(null)`.
                         */
                        fun fuelChargesCurrency(fuelChargesCurrency: Optional<String>) =
                            fuelChargesCurrency(fuelChargesCurrency.getOrNull())

                        /**
                         * Sets [Builder.fuelChargesCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.fuelChargesCurrency] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun fuelChargesCurrency(fuelChargesCurrency: JsonField<String>) = apply {
                            this.fuelChargesCurrency = fuelChargesCurrency
                        }

                        /** Any insurance being charged for the vehicle. */
                        fun insuranceChargesAmount(insuranceChargesAmount: Long?) =
                            insuranceChargesAmount(JsonField.ofNullable(insuranceChargesAmount))

                        /**
                         * Alias for [Builder.insuranceChargesAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun insuranceChargesAmount(insuranceChargesAmount: Long) =
                            insuranceChargesAmount(insuranceChargesAmount as Long?)

                        /**
                         * Alias for calling [Builder.insuranceChargesAmount] with
                         * `insuranceChargesAmount.orElse(null)`.
                         */
                        fun insuranceChargesAmount(insuranceChargesAmount: Optional<Long>) =
                            insuranceChargesAmount(insuranceChargesAmount.getOrNull())

                        /**
                         * Sets [Builder.insuranceChargesAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.insuranceChargesAmount] with a
                         * well-typed [Long] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun insuranceChargesAmount(insuranceChargesAmount: JsonField<Long>) =
                            apply {
                                this.insuranceChargesAmount = insuranceChargesAmount
                            }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * insurance charges assessed.
                         */
                        fun insuranceChargesCurrency(insuranceChargesCurrency: String?) =
                            insuranceChargesCurrency(JsonField.ofNullable(insuranceChargesCurrency))

                        /**
                         * Alias for calling [Builder.insuranceChargesCurrency] with
                         * `insuranceChargesCurrency.orElse(null)`.
                         */
                        fun insuranceChargesCurrency(insuranceChargesCurrency: Optional<String>) =
                            insuranceChargesCurrency(insuranceChargesCurrency.getOrNull())

                        /**
                         * Sets [Builder.insuranceChargesCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.insuranceChargesCurrency] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun insuranceChargesCurrency(insuranceChargesCurrency: JsonField<String>) =
                            apply {
                                this.insuranceChargesCurrency = insuranceChargesCurrency
                            }

                        /**
                         * An indicator that the cardholder is being billed for a reserved vehicle
                         * that was not actually rented (that is, a "no-show" charge).
                         */
                        fun noShowIndicator(noShowIndicator: NoShowIndicator?) =
                            noShowIndicator(JsonField.ofNullable(noShowIndicator))

                        /**
                         * Alias for calling [Builder.noShowIndicator] with
                         * `noShowIndicator.orElse(null)`.
                         */
                        fun noShowIndicator(noShowIndicator: Optional<NoShowIndicator>) =
                            noShowIndicator(noShowIndicator.getOrNull())

                        /**
                         * Sets [Builder.noShowIndicator] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.noShowIndicator] with a well-typed
                         * [NoShowIndicator] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun noShowIndicator(noShowIndicator: JsonField<NoShowIndicator>) = apply {
                            this.noShowIndicator = noShowIndicator
                        }

                        /**
                         * Charges for returning the vehicle at a different location than where it
                         * was picked up.
                         */
                        fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long?) =
                            oneWayDropOffChargesAmount(
                                JsonField.ofNullable(oneWayDropOffChargesAmount)
                            )

                        /**
                         * Alias for [Builder.oneWayDropOffChargesAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long) =
                            oneWayDropOffChargesAmount(oneWayDropOffChargesAmount as Long?)

                        /**
                         * Alias for calling [Builder.oneWayDropOffChargesAmount] with
                         * `oneWayDropOffChargesAmount.orElse(null)`.
                         */
                        fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Optional<Long>) =
                            oneWayDropOffChargesAmount(oneWayDropOffChargesAmount.getOrNull())

                        /**
                         * Sets [Builder.oneWayDropOffChargesAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.oneWayDropOffChargesAmount] with a
                         * well-typed [Long] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun oneWayDropOffChargesAmount(
                            oneWayDropOffChargesAmount: JsonField<Long>
                        ) = apply { this.oneWayDropOffChargesAmount = oneWayDropOffChargesAmount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * one-way drop-off charges assessed.
                         */
                        fun oneWayDropOffChargesCurrency(oneWayDropOffChargesCurrency: String?) =
                            oneWayDropOffChargesCurrency(
                                JsonField.ofNullable(oneWayDropOffChargesCurrency)
                            )

                        /**
                         * Alias for calling [Builder.oneWayDropOffChargesCurrency] with
                         * `oneWayDropOffChargesCurrency.orElse(null)`.
                         */
                        fun oneWayDropOffChargesCurrency(
                            oneWayDropOffChargesCurrency: Optional<String>
                        ) = oneWayDropOffChargesCurrency(oneWayDropOffChargesCurrency.getOrNull())

                        /**
                         * Sets [Builder.oneWayDropOffChargesCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.oneWayDropOffChargesCurrency] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun oneWayDropOffChargesCurrency(
                            oneWayDropOffChargesCurrency: JsonField<String>
                        ) = apply {
                            this.oneWayDropOffChargesCurrency = oneWayDropOffChargesCurrency
                        }

                        /** Name of the person renting the vehicle. */
                        fun renterName(renterName: String?) =
                            renterName(JsonField.ofNullable(renterName))

                        /**
                         * Alias for calling [Builder.renterName] with `renterName.orElse(null)`.
                         */
                        fun renterName(renterName: Optional<String>) =
                            renterName(renterName.getOrNull())

                        /**
                         * Sets [Builder.renterName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.renterName] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun renterName(renterName: JsonField<String>) = apply {
                            this.renterName = renterName
                        }

                        /** Weekly rate being charged for the vehicle. */
                        fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long?) =
                            weeklyRentalRateAmount(JsonField.ofNullable(weeklyRentalRateAmount))

                        /**
                         * Alias for [Builder.weeklyRentalRateAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long) =
                            weeklyRentalRateAmount(weeklyRentalRateAmount as Long?)

                        /**
                         * Alias for calling [Builder.weeklyRentalRateAmount] with
                         * `weeklyRentalRateAmount.orElse(null)`.
                         */
                        fun weeklyRentalRateAmount(weeklyRentalRateAmount: Optional<Long>) =
                            weeklyRentalRateAmount(weeklyRentalRateAmount.getOrNull())

                        /**
                         * Sets [Builder.weeklyRentalRateAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.weeklyRentalRateAmount] with a
                         * well-typed [Long] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun weeklyRentalRateAmount(weeklyRentalRateAmount: JsonField<Long>) =
                            apply {
                                this.weeklyRentalRateAmount = weeklyRentalRateAmount
                            }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * weekly rental rate.
                         */
                        fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: String?) =
                            weeklyRentalRateCurrency(JsonField.ofNullable(weeklyRentalRateCurrency))

                        /**
                         * Alias for calling [Builder.weeklyRentalRateCurrency] with
                         * `weeklyRentalRateCurrency.orElse(null)`.
                         */
                        fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: Optional<String>) =
                            weeklyRentalRateCurrency(weeklyRentalRateCurrency.getOrNull())

                        /**
                         * Sets [Builder.weeklyRentalRateCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.weeklyRentalRateCurrency] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: JsonField<String>) =
                            apply {
                                this.weeklyRentalRateCurrency = weeklyRentalRateCurrency
                            }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CarRental].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .carClassCode()
                         * .checkoutDate()
                         * .dailyRentalRateAmount()
                         * .dailyRentalRateCurrency()
                         * .daysRented()
                         * .extraCharges()
                         * .fuelChargesAmount()
                         * .fuelChargesCurrency()
                         * .insuranceChargesAmount()
                         * .insuranceChargesCurrency()
                         * .noShowIndicator()
                         * .oneWayDropOffChargesAmount()
                         * .oneWayDropOffChargesCurrency()
                         * .renterName()
                         * .weeklyRentalRateAmount()
                         * .weeklyRentalRateCurrency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CarRental =
                            CarRental(
                                checkRequired("carClassCode", carClassCode),
                                checkRequired("checkoutDate", checkoutDate),
                                checkRequired("dailyRentalRateAmount", dailyRentalRateAmount),
                                checkRequired("dailyRentalRateCurrency", dailyRentalRateCurrency),
                                checkRequired("daysRented", daysRented),
                                checkRequired("extraCharges", extraCharges),
                                checkRequired("fuelChargesAmount", fuelChargesAmount),
                                checkRequired("fuelChargesCurrency", fuelChargesCurrency),
                                checkRequired("insuranceChargesAmount", insuranceChargesAmount),
                                checkRequired("insuranceChargesCurrency", insuranceChargesCurrency),
                                checkRequired("noShowIndicator", noShowIndicator),
                                checkRequired(
                                    "oneWayDropOffChargesAmount",
                                    oneWayDropOffChargesAmount,
                                ),
                                checkRequired(
                                    "oneWayDropOffChargesCurrency",
                                    oneWayDropOffChargesCurrency,
                                ),
                                checkRequired("renterName", renterName),
                                checkRequired("weeklyRentalRateAmount", weeklyRentalRateAmount),
                                checkRequired("weeklyRentalRateCurrency", weeklyRentalRateCurrency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CarRental = apply {
                        if (validated) {
                            return@apply
                        }

                        carClassCode()
                        checkoutDate()
                        dailyRentalRateAmount()
                        dailyRentalRateCurrency()
                        daysRented()
                        extraCharges().ifPresent { it.validate() }
                        fuelChargesAmount()
                        fuelChargesCurrency()
                        insuranceChargesAmount()
                        insuranceChargesCurrency()
                        noShowIndicator().ifPresent { it.validate() }
                        oneWayDropOffChargesAmount()
                        oneWayDropOffChargesCurrency()
                        renterName()
                        weeklyRentalRateAmount()
                        weeklyRentalRateCurrency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (carClassCode.asKnown().isPresent) 1 else 0) +
                            (if (checkoutDate.asKnown().isPresent) 1 else 0) +
                            (if (dailyRentalRateAmount.asKnown().isPresent) 1 else 0) +
                            (if (dailyRentalRateCurrency.asKnown().isPresent) 1 else 0) +
                            (if (daysRented.asKnown().isPresent) 1 else 0) +
                            (extraCharges.asKnown().getOrNull()?.validity() ?: 0) +
                            (if (fuelChargesAmount.asKnown().isPresent) 1 else 0) +
                            (if (fuelChargesCurrency.asKnown().isPresent) 1 else 0) +
                            (if (insuranceChargesAmount.asKnown().isPresent) 1 else 0) +
                            (if (insuranceChargesCurrency.asKnown().isPresent) 1 else 0) +
                            (noShowIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                            (if (oneWayDropOffChargesAmount.asKnown().isPresent) 1 else 0) +
                            (if (oneWayDropOffChargesCurrency.asKnown().isPresent) 1 else 0) +
                            (if (renterName.asKnown().isPresent) 1 else 0) +
                            (if (weeklyRentalRateAmount.asKnown().isPresent) 1 else 0) +
                            (if (weeklyRentalRateCurrency.asKnown().isPresent) 1 else 0)

                    /** Additional charges (gas, late fee, etc.) being billed. */
                    class ExtraCharges
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** No extra charge */
                            @JvmField val NO_EXTRA_CHARGE = of("no_extra_charge")

                            /** Gas */
                            @JvmField val GAS = of("gas")

                            /** Extra mileage */
                            @JvmField val EXTRA_MILEAGE = of("extra_mileage")

                            /** Late return */
                            @JvmField val LATE_RETURN = of("late_return")

                            /** One way service fee */
                            @JvmField val ONE_WAY_SERVICE_FEE = of("one_way_service_fee")

                            /** Parking violation */
                            @JvmField val PARKING_VIOLATION = of("parking_violation")

                            @JvmStatic fun of(value: String) = ExtraCharges(JsonField.of(value))
                        }

                        /** An enum containing [ExtraCharges]'s known values. */
                        enum class Known {
                            /** No extra charge */
                            NO_EXTRA_CHARGE,
                            /** Gas */
                            GAS,
                            /** Extra mileage */
                            EXTRA_MILEAGE,
                            /** Late return */
                            LATE_RETURN,
                            /** One way service fee */
                            ONE_WAY_SERVICE_FEE,
                            /** Parking violation */
                            PARKING_VIOLATION,
                        }

                        /**
                         * An enum containing [ExtraCharges]'s known values, as well as an
                         * [_UNKNOWN] member.
                         *
                         * An instance of [ExtraCharges] can contain an unknown value in a couple of
                         * cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** No extra charge */
                            NO_EXTRA_CHARGE,
                            /** Gas */
                            GAS,
                            /** Extra mileage */
                            EXTRA_MILEAGE,
                            /** Late return */
                            LATE_RETURN,
                            /** One way service fee */
                            ONE_WAY_SERVICE_FEE,
                            /** Parking violation */
                            PARKING_VIOLATION,
                            /**
                             * An enum member indicating that [ExtraCharges] was instantiated with
                             * an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NO_EXTRA_CHARGE -> Value.NO_EXTRA_CHARGE
                                GAS -> Value.GAS
                                EXTRA_MILEAGE -> Value.EXTRA_MILEAGE
                                LATE_RETURN -> Value.LATE_RETURN
                                ONE_WAY_SERVICE_FEE -> Value.ONE_WAY_SERVICE_FEE
                                PARKING_VIOLATION -> Value.PARKING_VIOLATION
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NO_EXTRA_CHARGE -> Known.NO_EXTRA_CHARGE
                                GAS -> Known.GAS
                                EXTRA_MILEAGE -> Known.EXTRA_MILEAGE
                                LATE_RETURN -> Known.LATE_RETURN
                                ONE_WAY_SERVICE_FEE -> Known.ONE_WAY_SERVICE_FEE
                                PARKING_VIOLATION -> Known.PARKING_VIOLATION
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown ExtraCharges: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): ExtraCharges = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is ExtraCharges && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * An indicator that the cardholder is being billed for a reserved vehicle that
                     * was not actually rented (that is, a "no-show" charge).
                     */
                    class NoShowIndicator
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Not applicable */
                            @JvmField val NOT_APPLICABLE = of("not_applicable")

                            /** No show for specialized vehicle */
                            @JvmField
                            val NO_SHOW_FOR_SPECIALIZED_VEHICLE =
                                of("no_show_for_specialized_vehicle")

                            @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(value))
                        }

                        /** An enum containing [NoShowIndicator]'s known values. */
                        enum class Known {
                            /** Not applicable */
                            NOT_APPLICABLE,
                            /** No show for specialized vehicle */
                            NO_SHOW_FOR_SPECIALIZED_VEHICLE,
                        }

                        /**
                         * An enum containing [NoShowIndicator]'s known values, as well as an
                         * [_UNKNOWN] member.
                         *
                         * An instance of [NoShowIndicator] can contain an unknown value in a couple
                         * of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Not applicable */
                            NOT_APPLICABLE,
                            /** No show for specialized vehicle */
                            NO_SHOW_FOR_SPECIALIZED_VEHICLE,
                            /**
                             * An enum member indicating that [NoShowIndicator] was instantiated
                             * with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NOT_APPLICABLE -> Value.NOT_APPLICABLE
                                NO_SHOW_FOR_SPECIALIZED_VEHICLE ->
                                    Value.NO_SHOW_FOR_SPECIALIZED_VEHICLE
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NOT_APPLICABLE -> Known.NOT_APPLICABLE
                                NO_SHOW_FOR_SPECIALIZED_VEHICLE ->
                                    Known.NO_SHOW_FOR_SPECIALIZED_VEHICLE
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown NoShowIndicator: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): NoShowIndicator = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is NoShowIndicator && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CarRental &&
                            carClassCode == other.carClassCode &&
                            checkoutDate == other.checkoutDate &&
                            dailyRentalRateAmount == other.dailyRentalRateAmount &&
                            dailyRentalRateCurrency == other.dailyRentalRateCurrency &&
                            daysRented == other.daysRented &&
                            extraCharges == other.extraCharges &&
                            fuelChargesAmount == other.fuelChargesAmount &&
                            fuelChargesCurrency == other.fuelChargesCurrency &&
                            insuranceChargesAmount == other.insuranceChargesAmount &&
                            insuranceChargesCurrency == other.insuranceChargesCurrency &&
                            noShowIndicator == other.noShowIndicator &&
                            oneWayDropOffChargesAmount == other.oneWayDropOffChargesAmount &&
                            oneWayDropOffChargesCurrency == other.oneWayDropOffChargesCurrency &&
                            renterName == other.renterName &&
                            weeklyRentalRateAmount == other.weeklyRentalRateAmount &&
                            weeklyRentalRateCurrency == other.weeklyRentalRateCurrency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            carClassCode,
                            checkoutDate,
                            dailyRentalRateAmount,
                            dailyRentalRateCurrency,
                            daysRented,
                            extraCharges,
                            fuelChargesAmount,
                            fuelChargesCurrency,
                            insuranceChargesAmount,
                            insuranceChargesCurrency,
                            noShowIndicator,
                            oneWayDropOffChargesAmount,
                            oneWayDropOffChargesCurrency,
                            renterName,
                            weeklyRentalRateAmount,
                            weeklyRentalRateCurrency,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CarRental{carClassCode=$carClassCode, checkoutDate=$checkoutDate, dailyRentalRateAmount=$dailyRentalRateAmount, dailyRentalRateCurrency=$dailyRentalRateCurrency, daysRented=$daysRented, extraCharges=$extraCharges, fuelChargesAmount=$fuelChargesAmount, fuelChargesCurrency=$fuelChargesCurrency, insuranceChargesAmount=$insuranceChargesAmount, insuranceChargesCurrency=$insuranceChargesCurrency, noShowIndicator=$noShowIndicator, oneWayDropOffChargesAmount=$oneWayDropOffChargesAmount, oneWayDropOffChargesCurrency=$oneWayDropOffChargesCurrency, renterName=$renterName, weeklyRentalRateAmount=$weeklyRentalRateAmount, weeklyRentalRateCurrency=$weeklyRentalRateCurrency, additionalProperties=$additionalProperties}"
                }

                /** Fields specific to lodging. */
                class Lodging
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val checkInDate: JsonField<LocalDate>,
                    private val dailyRoomRateAmount: JsonField<Long>,
                    private val dailyRoomRateCurrency: JsonField<String>,
                    private val extraCharges: JsonField<ExtraCharges>,
                    private val folioCashAdvancesAmount: JsonField<Long>,
                    private val folioCashAdvancesCurrency: JsonField<String>,
                    private val foodBeverageChargesAmount: JsonField<Long>,
                    private val foodBeverageChargesCurrency: JsonField<String>,
                    private val noShowIndicator: JsonField<NoShowIndicator>,
                    private val prepaidExpensesAmount: JsonField<Long>,
                    private val prepaidExpensesCurrency: JsonField<String>,
                    private val roomNights: JsonField<Long>,
                    private val totalRoomTaxAmount: JsonField<Long>,
                    private val totalRoomTaxCurrency: JsonField<String>,
                    private val totalTaxAmount: JsonField<Long>,
                    private val totalTaxCurrency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("check_in_date")
                        @ExcludeMissing
                        checkInDate: JsonField<LocalDate> = JsonMissing.of(),
                        @JsonProperty("daily_room_rate_amount")
                        @ExcludeMissing
                        dailyRoomRateAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("daily_room_rate_currency")
                        @ExcludeMissing
                        dailyRoomRateCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("extra_charges")
                        @ExcludeMissing
                        extraCharges: JsonField<ExtraCharges> = JsonMissing.of(),
                        @JsonProperty("folio_cash_advances_amount")
                        @ExcludeMissing
                        folioCashAdvancesAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("folio_cash_advances_currency")
                        @ExcludeMissing
                        folioCashAdvancesCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("food_beverage_charges_amount")
                        @ExcludeMissing
                        foodBeverageChargesAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("food_beverage_charges_currency")
                        @ExcludeMissing
                        foodBeverageChargesCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("no_show_indicator")
                        @ExcludeMissing
                        noShowIndicator: JsonField<NoShowIndicator> = JsonMissing.of(),
                        @JsonProperty("prepaid_expenses_amount")
                        @ExcludeMissing
                        prepaidExpensesAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("prepaid_expenses_currency")
                        @ExcludeMissing
                        prepaidExpensesCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("room_nights")
                        @ExcludeMissing
                        roomNights: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("total_room_tax_amount")
                        @ExcludeMissing
                        totalRoomTaxAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("total_room_tax_currency")
                        @ExcludeMissing
                        totalRoomTaxCurrency: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("total_tax_amount")
                        @ExcludeMissing
                        totalTaxAmount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("total_tax_currency")
                        @ExcludeMissing
                        totalTaxCurrency: JsonField<String> = JsonMissing.of(),
                    ) : this(
                        checkInDate,
                        dailyRoomRateAmount,
                        dailyRoomRateCurrency,
                        extraCharges,
                        folioCashAdvancesAmount,
                        folioCashAdvancesCurrency,
                        foodBeverageChargesAmount,
                        foodBeverageChargesCurrency,
                        noShowIndicator,
                        prepaidExpensesAmount,
                        prepaidExpensesCurrency,
                        roomNights,
                        totalRoomTaxAmount,
                        totalRoomTaxCurrency,
                        totalTaxAmount,
                        totalTaxCurrency,
                        mutableMapOf(),
                    )

                    /**
                     * Date the customer checked in.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun checkInDate(): Optional<LocalDate> =
                        checkInDate.getOptional("check_in_date")

                    /**
                     * Daily rate being charged for the room.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun dailyRoomRateAmount(): Optional<Long> =
                        dailyRoomRateAmount.getOptional("daily_room_rate_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily
                     * room rate.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun dailyRoomRateCurrency(): Optional<String> =
                        dailyRoomRateCurrency.getOptional("daily_room_rate_currency")

                    /**
                     * Additional charges (phone, late check-out, etc.) being billed.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun extraCharges(): Optional<ExtraCharges> =
                        extraCharges.getOptional("extra_charges")

                    /**
                     * Folio cash advances for the room.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun folioCashAdvancesAmount(): Optional<Long> =
                        folioCashAdvancesAmount.getOptional("folio_cash_advances_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio
                     * cash advances.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun folioCashAdvancesCurrency(): Optional<String> =
                        folioCashAdvancesCurrency.getOptional("folio_cash_advances_currency")

                    /**
                     * Food and beverage charges for the room.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun foodBeverageChargesAmount(): Optional<Long> =
                        foodBeverageChargesAmount.getOptional("food_beverage_charges_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the food and
                     * beverage charges.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun foodBeverageChargesCurrency(): Optional<String> =
                        foodBeverageChargesCurrency.getOptional("food_beverage_charges_currency")

                    /**
                     * Indicator that the cardholder is being billed for a reserved room that was
                     * not actually used.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun noShowIndicator(): Optional<NoShowIndicator> =
                        noShowIndicator.getOptional("no_show_indicator")

                    /**
                     * Prepaid expenses being charged for the room.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun prepaidExpensesAmount(): Optional<Long> =
                        prepaidExpensesAmount.getOptional("prepaid_expenses_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the prepaid
                     * expenses.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun prepaidExpensesCurrency(): Optional<String> =
                        prepaidExpensesCurrency.getOptional("prepaid_expenses_currency")

                    /**
                     * Number of nights the room was rented.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun roomNights(): Optional<Long> = roomNights.getOptional("room_nights")

                    /**
                     * Total room tax being charged.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun totalRoomTaxAmount(): Optional<Long> =
                        totalRoomTaxAmount.getOptional("total_room_tax_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total
                     * room tax.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun totalRoomTaxCurrency(): Optional<String> =
                        totalRoomTaxCurrency.getOptional("total_room_tax_currency")

                    /**
                     * Total tax being charged for the room.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun totalTaxAmount(): Optional<Long> =
                        totalTaxAmount.getOptional("total_tax_amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total tax
                     * assessed.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun totalTaxCurrency(): Optional<String> =
                        totalTaxCurrency.getOptional("total_tax_currency")

                    /**
                     * Returns the raw JSON value of [checkInDate].
                     *
                     * Unlike [checkInDate], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("check_in_date")
                    @ExcludeMissing
                    fun _checkInDate(): JsonField<LocalDate> = checkInDate

                    /**
                     * Returns the raw JSON value of [dailyRoomRateAmount].
                     *
                     * Unlike [dailyRoomRateAmount], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("daily_room_rate_amount")
                    @ExcludeMissing
                    fun _dailyRoomRateAmount(): JsonField<Long> = dailyRoomRateAmount

                    /**
                     * Returns the raw JSON value of [dailyRoomRateCurrency].
                     *
                     * Unlike [dailyRoomRateCurrency], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("daily_room_rate_currency")
                    @ExcludeMissing
                    fun _dailyRoomRateCurrency(): JsonField<String> = dailyRoomRateCurrency

                    /**
                     * Returns the raw JSON value of [extraCharges].
                     *
                     * Unlike [extraCharges], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("extra_charges")
                    @ExcludeMissing
                    fun _extraCharges(): JsonField<ExtraCharges> = extraCharges

                    /**
                     * Returns the raw JSON value of [folioCashAdvancesAmount].
                     *
                     * Unlike [folioCashAdvancesAmount], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("folio_cash_advances_amount")
                    @ExcludeMissing
                    fun _folioCashAdvancesAmount(): JsonField<Long> = folioCashAdvancesAmount

                    /**
                     * Returns the raw JSON value of [folioCashAdvancesCurrency].
                     *
                     * Unlike [folioCashAdvancesCurrency], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("folio_cash_advances_currency")
                    @ExcludeMissing
                    fun _folioCashAdvancesCurrency(): JsonField<String> = folioCashAdvancesCurrency

                    /**
                     * Returns the raw JSON value of [foodBeverageChargesAmount].
                     *
                     * Unlike [foodBeverageChargesAmount], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("food_beverage_charges_amount")
                    @ExcludeMissing
                    fun _foodBeverageChargesAmount(): JsonField<Long> = foodBeverageChargesAmount

                    /**
                     * Returns the raw JSON value of [foodBeverageChargesCurrency].
                     *
                     * Unlike [foodBeverageChargesCurrency], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("food_beverage_charges_currency")
                    @ExcludeMissing
                    fun _foodBeverageChargesCurrency(): JsonField<String> =
                        foodBeverageChargesCurrency

                    /**
                     * Returns the raw JSON value of [noShowIndicator].
                     *
                     * Unlike [noShowIndicator], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("no_show_indicator")
                    @ExcludeMissing
                    fun _noShowIndicator(): JsonField<NoShowIndicator> = noShowIndicator

                    /**
                     * Returns the raw JSON value of [prepaidExpensesAmount].
                     *
                     * Unlike [prepaidExpensesAmount], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("prepaid_expenses_amount")
                    @ExcludeMissing
                    fun _prepaidExpensesAmount(): JsonField<Long> = prepaidExpensesAmount

                    /**
                     * Returns the raw JSON value of [prepaidExpensesCurrency].
                     *
                     * Unlike [prepaidExpensesCurrency], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("prepaid_expenses_currency")
                    @ExcludeMissing
                    fun _prepaidExpensesCurrency(): JsonField<String> = prepaidExpensesCurrency

                    /**
                     * Returns the raw JSON value of [roomNights].
                     *
                     * Unlike [roomNights], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("room_nights")
                    @ExcludeMissing
                    fun _roomNights(): JsonField<Long> = roomNights

                    /**
                     * Returns the raw JSON value of [totalRoomTaxAmount].
                     *
                     * Unlike [totalRoomTaxAmount], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("total_room_tax_amount")
                    @ExcludeMissing
                    fun _totalRoomTaxAmount(): JsonField<Long> = totalRoomTaxAmount

                    /**
                     * Returns the raw JSON value of [totalRoomTaxCurrency].
                     *
                     * Unlike [totalRoomTaxCurrency], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("total_room_tax_currency")
                    @ExcludeMissing
                    fun _totalRoomTaxCurrency(): JsonField<String> = totalRoomTaxCurrency

                    /**
                     * Returns the raw JSON value of [totalTaxAmount].
                     *
                     * Unlike [totalTaxAmount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("total_tax_amount")
                    @ExcludeMissing
                    fun _totalTaxAmount(): JsonField<Long> = totalTaxAmount

                    /**
                     * Returns the raw JSON value of [totalTaxCurrency].
                     *
                     * Unlike [totalTaxCurrency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("total_tax_currency")
                    @ExcludeMissing
                    fun _totalTaxCurrency(): JsonField<String> = totalTaxCurrency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Lodging].
                         *
                         * The following fields are required:
                         * ```java
                         * .checkInDate()
                         * .dailyRoomRateAmount()
                         * .dailyRoomRateCurrency()
                         * .extraCharges()
                         * .folioCashAdvancesAmount()
                         * .folioCashAdvancesCurrency()
                         * .foodBeverageChargesAmount()
                         * .foodBeverageChargesCurrency()
                         * .noShowIndicator()
                         * .prepaidExpensesAmount()
                         * .prepaidExpensesCurrency()
                         * .roomNights()
                         * .totalRoomTaxAmount()
                         * .totalRoomTaxCurrency()
                         * .totalTaxAmount()
                         * .totalTaxCurrency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Lodging]. */
                    class Builder internal constructor() {

                        private var checkInDate: JsonField<LocalDate>? = null
                        private var dailyRoomRateAmount: JsonField<Long>? = null
                        private var dailyRoomRateCurrency: JsonField<String>? = null
                        private var extraCharges: JsonField<ExtraCharges>? = null
                        private var folioCashAdvancesAmount: JsonField<Long>? = null
                        private var folioCashAdvancesCurrency: JsonField<String>? = null
                        private var foodBeverageChargesAmount: JsonField<Long>? = null
                        private var foodBeverageChargesCurrency: JsonField<String>? = null
                        private var noShowIndicator: JsonField<NoShowIndicator>? = null
                        private var prepaidExpensesAmount: JsonField<Long>? = null
                        private var prepaidExpensesCurrency: JsonField<String>? = null
                        private var roomNights: JsonField<Long>? = null
                        private var totalRoomTaxAmount: JsonField<Long>? = null
                        private var totalRoomTaxCurrency: JsonField<String>? = null
                        private var totalTaxAmount: JsonField<Long>? = null
                        private var totalTaxCurrency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(lodging: Lodging) = apply {
                            checkInDate = lodging.checkInDate
                            dailyRoomRateAmount = lodging.dailyRoomRateAmount
                            dailyRoomRateCurrency = lodging.dailyRoomRateCurrency
                            extraCharges = lodging.extraCharges
                            folioCashAdvancesAmount = lodging.folioCashAdvancesAmount
                            folioCashAdvancesCurrency = lodging.folioCashAdvancesCurrency
                            foodBeverageChargesAmount = lodging.foodBeverageChargesAmount
                            foodBeverageChargesCurrency = lodging.foodBeverageChargesCurrency
                            noShowIndicator = lodging.noShowIndicator
                            prepaidExpensesAmount = lodging.prepaidExpensesAmount
                            prepaidExpensesCurrency = lodging.prepaidExpensesCurrency
                            roomNights = lodging.roomNights
                            totalRoomTaxAmount = lodging.totalRoomTaxAmount
                            totalRoomTaxCurrency = lodging.totalRoomTaxCurrency
                            totalTaxAmount = lodging.totalTaxAmount
                            totalTaxCurrency = lodging.totalTaxCurrency
                            additionalProperties = lodging.additionalProperties.toMutableMap()
                        }

                        /** Date the customer checked in. */
                        fun checkInDate(checkInDate: LocalDate?) =
                            checkInDate(JsonField.ofNullable(checkInDate))

                        /**
                         * Alias for calling [Builder.checkInDate] with `checkInDate.orElse(null)`.
                         */
                        fun checkInDate(checkInDate: Optional<LocalDate>) =
                            checkInDate(checkInDate.getOrNull())

                        /**
                         * Sets [Builder.checkInDate] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.checkInDate] with a well-typed
                         * [LocalDate] value instead. This method is primarily for setting the field
                         * to an undocumented or not yet supported value.
                         */
                        fun checkInDate(checkInDate: JsonField<LocalDate>) = apply {
                            this.checkInDate = checkInDate
                        }

                        /** Daily rate being charged for the room. */
                        fun dailyRoomRateAmount(dailyRoomRateAmount: Long?) =
                            dailyRoomRateAmount(JsonField.ofNullable(dailyRoomRateAmount))

                        /**
                         * Alias for [Builder.dailyRoomRateAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun dailyRoomRateAmount(dailyRoomRateAmount: Long) =
                            dailyRoomRateAmount(dailyRoomRateAmount as Long?)

                        /**
                         * Alias for calling [Builder.dailyRoomRateAmount] with
                         * `dailyRoomRateAmount.orElse(null)`.
                         */
                        fun dailyRoomRateAmount(dailyRoomRateAmount: Optional<Long>) =
                            dailyRoomRateAmount(dailyRoomRateAmount.getOrNull())

                        /**
                         * Sets [Builder.dailyRoomRateAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.dailyRoomRateAmount] with a well-typed
                         * [Long] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun dailyRoomRateAmount(dailyRoomRateAmount: JsonField<Long>) = apply {
                            this.dailyRoomRateAmount = dailyRoomRateAmount
                        }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily
                         * room rate.
                         */
                        fun dailyRoomRateCurrency(dailyRoomRateCurrency: String?) =
                            dailyRoomRateCurrency(JsonField.ofNullable(dailyRoomRateCurrency))

                        /**
                         * Alias for calling [Builder.dailyRoomRateCurrency] with
                         * `dailyRoomRateCurrency.orElse(null)`.
                         */
                        fun dailyRoomRateCurrency(dailyRoomRateCurrency: Optional<String>) =
                            dailyRoomRateCurrency(dailyRoomRateCurrency.getOrNull())

                        /**
                         * Sets [Builder.dailyRoomRateCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.dailyRoomRateCurrency] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun dailyRoomRateCurrency(dailyRoomRateCurrency: JsonField<String>) =
                            apply {
                                this.dailyRoomRateCurrency = dailyRoomRateCurrency
                            }

                        /** Additional charges (phone, late check-out, etc.) being billed. */
                        fun extraCharges(extraCharges: ExtraCharges?) =
                            extraCharges(JsonField.ofNullable(extraCharges))

                        /**
                         * Alias for calling [Builder.extraCharges] with
                         * `extraCharges.orElse(null)`.
                         */
                        fun extraCharges(extraCharges: Optional<ExtraCharges>) =
                            extraCharges(extraCharges.getOrNull())

                        /**
                         * Sets [Builder.extraCharges] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.extraCharges] with a well-typed
                         * [ExtraCharges] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun extraCharges(extraCharges: JsonField<ExtraCharges>) = apply {
                            this.extraCharges = extraCharges
                        }

                        /** Folio cash advances for the room. */
                        fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long?) =
                            folioCashAdvancesAmount(JsonField.ofNullable(folioCashAdvancesAmount))

                        /**
                         * Alias for [Builder.folioCashAdvancesAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long) =
                            folioCashAdvancesAmount(folioCashAdvancesAmount as Long?)

                        /**
                         * Alias for calling [Builder.folioCashAdvancesAmount] with
                         * `folioCashAdvancesAmount.orElse(null)`.
                         */
                        fun folioCashAdvancesAmount(folioCashAdvancesAmount: Optional<Long>) =
                            folioCashAdvancesAmount(folioCashAdvancesAmount.getOrNull())

                        /**
                         * Sets [Builder.folioCashAdvancesAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.folioCashAdvancesAmount] with a
                         * well-typed [Long] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun folioCashAdvancesAmount(folioCashAdvancesAmount: JsonField<Long>) =
                            apply {
                                this.folioCashAdvancesAmount = folioCashAdvancesAmount
                            }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio
                         * cash advances.
                         */
                        fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: String?) =
                            folioCashAdvancesCurrency(
                                JsonField.ofNullable(folioCashAdvancesCurrency)
                            )

                        /**
                         * Alias for calling [Builder.folioCashAdvancesCurrency] with
                         * `folioCashAdvancesCurrency.orElse(null)`.
                         */
                        fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: Optional<String>) =
                            folioCashAdvancesCurrency(folioCashAdvancesCurrency.getOrNull())

                        /**
                         * Sets [Builder.folioCashAdvancesCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.folioCashAdvancesCurrency] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun folioCashAdvancesCurrency(
                            folioCashAdvancesCurrency: JsonField<String>
                        ) = apply { this.folioCashAdvancesCurrency = folioCashAdvancesCurrency }

                        /** Food and beverage charges for the room. */
                        fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long?) =
                            foodBeverageChargesAmount(
                                JsonField.ofNullable(foodBeverageChargesAmount)
                            )

                        /**
                         * Alias for [Builder.foodBeverageChargesAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long) =
                            foodBeverageChargesAmount(foodBeverageChargesAmount as Long?)

                        /**
                         * Alias for calling [Builder.foodBeverageChargesAmount] with
                         * `foodBeverageChargesAmount.orElse(null)`.
                         */
                        fun foodBeverageChargesAmount(foodBeverageChargesAmount: Optional<Long>) =
                            foodBeverageChargesAmount(foodBeverageChargesAmount.getOrNull())

                        /**
                         * Sets [Builder.foodBeverageChargesAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.foodBeverageChargesAmount] with a
                         * well-typed [Long] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun foodBeverageChargesAmount(foodBeverageChargesAmount: JsonField<Long>) =
                            apply {
                                this.foodBeverageChargesAmount = foodBeverageChargesAmount
                            }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the food
                         * and beverage charges.
                         */
                        fun foodBeverageChargesCurrency(foodBeverageChargesCurrency: String?) =
                            foodBeverageChargesCurrency(
                                JsonField.ofNullable(foodBeverageChargesCurrency)
                            )

                        /**
                         * Alias for calling [Builder.foodBeverageChargesCurrency] with
                         * `foodBeverageChargesCurrency.orElse(null)`.
                         */
                        fun foodBeverageChargesCurrency(
                            foodBeverageChargesCurrency: Optional<String>
                        ) = foodBeverageChargesCurrency(foodBeverageChargesCurrency.getOrNull())

                        /**
                         * Sets [Builder.foodBeverageChargesCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.foodBeverageChargesCurrency] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun foodBeverageChargesCurrency(
                            foodBeverageChargesCurrency: JsonField<String>
                        ) = apply { this.foodBeverageChargesCurrency = foodBeverageChargesCurrency }

                        /**
                         * Indicator that the cardholder is being billed for a reserved room that
                         * was not actually used.
                         */
                        fun noShowIndicator(noShowIndicator: NoShowIndicator?) =
                            noShowIndicator(JsonField.ofNullable(noShowIndicator))

                        /**
                         * Alias for calling [Builder.noShowIndicator] with
                         * `noShowIndicator.orElse(null)`.
                         */
                        fun noShowIndicator(noShowIndicator: Optional<NoShowIndicator>) =
                            noShowIndicator(noShowIndicator.getOrNull())

                        /**
                         * Sets [Builder.noShowIndicator] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.noShowIndicator] with a well-typed
                         * [NoShowIndicator] value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun noShowIndicator(noShowIndicator: JsonField<NoShowIndicator>) = apply {
                            this.noShowIndicator = noShowIndicator
                        }

                        /** Prepaid expenses being charged for the room. */
                        fun prepaidExpensesAmount(prepaidExpensesAmount: Long?) =
                            prepaidExpensesAmount(JsonField.ofNullable(prepaidExpensesAmount))

                        /**
                         * Alias for [Builder.prepaidExpensesAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun prepaidExpensesAmount(prepaidExpensesAmount: Long) =
                            prepaidExpensesAmount(prepaidExpensesAmount as Long?)

                        /**
                         * Alias for calling [Builder.prepaidExpensesAmount] with
                         * `prepaidExpensesAmount.orElse(null)`.
                         */
                        fun prepaidExpensesAmount(prepaidExpensesAmount: Optional<Long>) =
                            prepaidExpensesAmount(prepaidExpensesAmount.getOrNull())

                        /**
                         * Sets [Builder.prepaidExpensesAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.prepaidExpensesAmount] with a well-typed
                         * [Long] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun prepaidExpensesAmount(prepaidExpensesAmount: JsonField<Long>) = apply {
                            this.prepaidExpensesAmount = prepaidExpensesAmount
                        }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * prepaid expenses.
                         */
                        fun prepaidExpensesCurrency(prepaidExpensesCurrency: String?) =
                            prepaidExpensesCurrency(JsonField.ofNullable(prepaidExpensesCurrency))

                        /**
                         * Alias for calling [Builder.prepaidExpensesCurrency] with
                         * `prepaidExpensesCurrency.orElse(null)`.
                         */
                        fun prepaidExpensesCurrency(prepaidExpensesCurrency: Optional<String>) =
                            prepaidExpensesCurrency(prepaidExpensesCurrency.getOrNull())

                        /**
                         * Sets [Builder.prepaidExpensesCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.prepaidExpensesCurrency] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun prepaidExpensesCurrency(prepaidExpensesCurrency: JsonField<String>) =
                            apply {
                                this.prepaidExpensesCurrency = prepaidExpensesCurrency
                            }

                        /** Number of nights the room was rented. */
                        fun roomNights(roomNights: Long?) =
                            roomNights(JsonField.ofNullable(roomNights))

                        /**
                         * Alias for [Builder.roomNights].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun roomNights(roomNights: Long) = roomNights(roomNights as Long?)

                        /**
                         * Alias for calling [Builder.roomNights] with `roomNights.orElse(null)`.
                         */
                        fun roomNights(roomNights: Optional<Long>) =
                            roomNights(roomNights.getOrNull())

                        /**
                         * Sets [Builder.roomNights] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.roomNights] with a well-typed [Long]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun roomNights(roomNights: JsonField<Long>) = apply {
                            this.roomNights = roomNights
                        }

                        /** Total room tax being charged. */
                        fun totalRoomTaxAmount(totalRoomTaxAmount: Long?) =
                            totalRoomTaxAmount(JsonField.ofNullable(totalRoomTaxAmount))

                        /**
                         * Alias for [Builder.totalRoomTaxAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun totalRoomTaxAmount(totalRoomTaxAmount: Long) =
                            totalRoomTaxAmount(totalRoomTaxAmount as Long?)

                        /**
                         * Alias for calling [Builder.totalRoomTaxAmount] with
                         * `totalRoomTaxAmount.orElse(null)`.
                         */
                        fun totalRoomTaxAmount(totalRoomTaxAmount: Optional<Long>) =
                            totalRoomTaxAmount(totalRoomTaxAmount.getOrNull())

                        /**
                         * Sets [Builder.totalRoomTaxAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.totalRoomTaxAmount] with a well-typed
                         * [Long] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun totalRoomTaxAmount(totalRoomTaxAmount: JsonField<Long>) = apply {
                            this.totalRoomTaxAmount = totalRoomTaxAmount
                        }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total
                         * room tax.
                         */
                        fun totalRoomTaxCurrency(totalRoomTaxCurrency: String?) =
                            totalRoomTaxCurrency(JsonField.ofNullable(totalRoomTaxCurrency))

                        /**
                         * Alias for calling [Builder.totalRoomTaxCurrency] with
                         * `totalRoomTaxCurrency.orElse(null)`.
                         */
                        fun totalRoomTaxCurrency(totalRoomTaxCurrency: Optional<String>) =
                            totalRoomTaxCurrency(totalRoomTaxCurrency.getOrNull())

                        /**
                         * Sets [Builder.totalRoomTaxCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.totalRoomTaxCurrency] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun totalRoomTaxCurrency(totalRoomTaxCurrency: JsonField<String>) = apply {
                            this.totalRoomTaxCurrency = totalRoomTaxCurrency
                        }

                        /** Total tax being charged for the room. */
                        fun totalTaxAmount(totalTaxAmount: Long?) =
                            totalTaxAmount(JsonField.ofNullable(totalTaxAmount))

                        /**
                         * Alias for [Builder.totalTaxAmount].
                         *
                         * This unboxed primitive overload exists for backwards compatibility.
                         */
                        fun totalTaxAmount(totalTaxAmount: Long) =
                            totalTaxAmount(totalTaxAmount as Long?)

                        /**
                         * Alias for calling [Builder.totalTaxAmount] with
                         * `totalTaxAmount.orElse(null)`.
                         */
                        fun totalTaxAmount(totalTaxAmount: Optional<Long>) =
                            totalTaxAmount(totalTaxAmount.getOrNull())

                        /**
                         * Sets [Builder.totalTaxAmount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.totalTaxAmount] with a well-typed [Long]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun totalTaxAmount(totalTaxAmount: JsonField<Long>) = apply {
                            this.totalTaxAmount = totalTaxAmount
                        }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total
                         * tax assessed.
                         */
                        fun totalTaxCurrency(totalTaxCurrency: String?) =
                            totalTaxCurrency(JsonField.ofNullable(totalTaxCurrency))

                        /**
                         * Alias for calling [Builder.totalTaxCurrency] with
                         * `totalTaxCurrency.orElse(null)`.
                         */
                        fun totalTaxCurrency(totalTaxCurrency: Optional<String>) =
                            totalTaxCurrency(totalTaxCurrency.getOrNull())

                        /**
                         * Sets [Builder.totalTaxCurrency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.totalTaxCurrency] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun totalTaxCurrency(totalTaxCurrency: JsonField<String>) = apply {
                            this.totalTaxCurrency = totalTaxCurrency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Lodging].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .checkInDate()
                         * .dailyRoomRateAmount()
                         * .dailyRoomRateCurrency()
                         * .extraCharges()
                         * .folioCashAdvancesAmount()
                         * .folioCashAdvancesCurrency()
                         * .foodBeverageChargesAmount()
                         * .foodBeverageChargesCurrency()
                         * .noShowIndicator()
                         * .prepaidExpensesAmount()
                         * .prepaidExpensesCurrency()
                         * .roomNights()
                         * .totalRoomTaxAmount()
                         * .totalRoomTaxCurrency()
                         * .totalTaxAmount()
                         * .totalTaxCurrency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Lodging =
                            Lodging(
                                checkRequired("checkInDate", checkInDate),
                                checkRequired("dailyRoomRateAmount", dailyRoomRateAmount),
                                checkRequired("dailyRoomRateCurrency", dailyRoomRateCurrency),
                                checkRequired("extraCharges", extraCharges),
                                checkRequired("folioCashAdvancesAmount", folioCashAdvancesAmount),
                                checkRequired(
                                    "folioCashAdvancesCurrency",
                                    folioCashAdvancesCurrency,
                                ),
                                checkRequired(
                                    "foodBeverageChargesAmount",
                                    foodBeverageChargesAmount,
                                ),
                                checkRequired(
                                    "foodBeverageChargesCurrency",
                                    foodBeverageChargesCurrency,
                                ),
                                checkRequired("noShowIndicator", noShowIndicator),
                                checkRequired("prepaidExpensesAmount", prepaidExpensesAmount),
                                checkRequired("prepaidExpensesCurrency", prepaidExpensesCurrency),
                                checkRequired("roomNights", roomNights),
                                checkRequired("totalRoomTaxAmount", totalRoomTaxAmount),
                                checkRequired("totalRoomTaxCurrency", totalRoomTaxCurrency),
                                checkRequired("totalTaxAmount", totalTaxAmount),
                                checkRequired("totalTaxCurrency", totalTaxCurrency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Lodging = apply {
                        if (validated) {
                            return@apply
                        }

                        checkInDate()
                        dailyRoomRateAmount()
                        dailyRoomRateCurrency()
                        extraCharges().ifPresent { it.validate() }
                        folioCashAdvancesAmount()
                        folioCashAdvancesCurrency()
                        foodBeverageChargesAmount()
                        foodBeverageChargesCurrency()
                        noShowIndicator().ifPresent { it.validate() }
                        prepaidExpensesAmount()
                        prepaidExpensesCurrency()
                        roomNights()
                        totalRoomTaxAmount()
                        totalRoomTaxCurrency()
                        totalTaxAmount()
                        totalTaxCurrency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (checkInDate.asKnown().isPresent) 1 else 0) +
                            (if (dailyRoomRateAmount.asKnown().isPresent) 1 else 0) +
                            (if (dailyRoomRateCurrency.asKnown().isPresent) 1 else 0) +
                            (extraCharges.asKnown().getOrNull()?.validity() ?: 0) +
                            (if (folioCashAdvancesAmount.asKnown().isPresent) 1 else 0) +
                            (if (folioCashAdvancesCurrency.asKnown().isPresent) 1 else 0) +
                            (if (foodBeverageChargesAmount.asKnown().isPresent) 1 else 0) +
                            (if (foodBeverageChargesCurrency.asKnown().isPresent) 1 else 0) +
                            (noShowIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                            (if (prepaidExpensesAmount.asKnown().isPresent) 1 else 0) +
                            (if (prepaidExpensesCurrency.asKnown().isPresent) 1 else 0) +
                            (if (roomNights.asKnown().isPresent) 1 else 0) +
                            (if (totalRoomTaxAmount.asKnown().isPresent) 1 else 0) +
                            (if (totalRoomTaxCurrency.asKnown().isPresent) 1 else 0) +
                            (if (totalTaxAmount.asKnown().isPresent) 1 else 0) +
                            (if (totalTaxCurrency.asKnown().isPresent) 1 else 0)

                    /** Additional charges (phone, late check-out, etc.) being billed. */
                    class ExtraCharges
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** No extra charge */
                            @JvmField val NO_EXTRA_CHARGE = of("no_extra_charge")

                            /** Restaurant */
                            @JvmField val RESTAURANT = of("restaurant")

                            /** Gift shop */
                            @JvmField val GIFT_SHOP = of("gift_shop")

                            /** Mini bar */
                            @JvmField val MINI_BAR = of("mini_bar")

                            /** Telephone */
                            @JvmField val TELEPHONE = of("telephone")

                            /** Other */
                            @JvmField val OTHER = of("other")

                            /** Laundry */
                            @JvmField val LAUNDRY = of("laundry")

                            @JvmStatic fun of(value: String) = ExtraCharges(JsonField.of(value))
                        }

                        /** An enum containing [ExtraCharges]'s known values. */
                        enum class Known {
                            /** No extra charge */
                            NO_EXTRA_CHARGE,
                            /** Restaurant */
                            RESTAURANT,
                            /** Gift shop */
                            GIFT_SHOP,
                            /** Mini bar */
                            MINI_BAR,
                            /** Telephone */
                            TELEPHONE,
                            /** Other */
                            OTHER,
                            /** Laundry */
                            LAUNDRY,
                        }

                        /**
                         * An enum containing [ExtraCharges]'s known values, as well as an
                         * [_UNKNOWN] member.
                         *
                         * An instance of [ExtraCharges] can contain an unknown value in a couple of
                         * cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** No extra charge */
                            NO_EXTRA_CHARGE,
                            /** Restaurant */
                            RESTAURANT,
                            /** Gift shop */
                            GIFT_SHOP,
                            /** Mini bar */
                            MINI_BAR,
                            /** Telephone */
                            TELEPHONE,
                            /** Other */
                            OTHER,
                            /** Laundry */
                            LAUNDRY,
                            /**
                             * An enum member indicating that [ExtraCharges] was instantiated with
                             * an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NO_EXTRA_CHARGE -> Value.NO_EXTRA_CHARGE
                                RESTAURANT -> Value.RESTAURANT
                                GIFT_SHOP -> Value.GIFT_SHOP
                                MINI_BAR -> Value.MINI_BAR
                                TELEPHONE -> Value.TELEPHONE
                                OTHER -> Value.OTHER
                                LAUNDRY -> Value.LAUNDRY
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NO_EXTRA_CHARGE -> Known.NO_EXTRA_CHARGE
                                RESTAURANT -> Known.RESTAURANT
                                GIFT_SHOP -> Known.GIFT_SHOP
                                MINI_BAR -> Known.MINI_BAR
                                TELEPHONE -> Known.TELEPHONE
                                OTHER -> Known.OTHER
                                LAUNDRY -> Known.LAUNDRY
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown ExtraCharges: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): ExtraCharges = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is ExtraCharges && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * Indicator that the cardholder is being billed for a reserved room that was
                     * not actually used.
                     */
                    class NoShowIndicator
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Not applicable */
                            @JvmField val NOT_APPLICABLE = of("not_applicable")

                            /** No show */
                            @JvmField val NO_SHOW = of("no_show")

                            @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(value))
                        }

                        /** An enum containing [NoShowIndicator]'s known values. */
                        enum class Known {
                            /** Not applicable */
                            NOT_APPLICABLE,
                            /** No show */
                            NO_SHOW,
                        }

                        /**
                         * An enum containing [NoShowIndicator]'s known values, as well as an
                         * [_UNKNOWN] member.
                         *
                         * An instance of [NoShowIndicator] can contain an unknown value in a couple
                         * of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Not applicable */
                            NOT_APPLICABLE,
                            /** No show */
                            NO_SHOW,
                            /**
                             * An enum member indicating that [NoShowIndicator] was instantiated
                             * with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NOT_APPLICABLE -> Value.NOT_APPLICABLE
                                NO_SHOW -> Value.NO_SHOW
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NOT_APPLICABLE -> Known.NOT_APPLICABLE
                                NO_SHOW -> Known.NO_SHOW
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown NoShowIndicator: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): NoShowIndicator = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is NoShowIndicator && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Lodging &&
                            checkInDate == other.checkInDate &&
                            dailyRoomRateAmount == other.dailyRoomRateAmount &&
                            dailyRoomRateCurrency == other.dailyRoomRateCurrency &&
                            extraCharges == other.extraCharges &&
                            folioCashAdvancesAmount == other.folioCashAdvancesAmount &&
                            folioCashAdvancesCurrency == other.folioCashAdvancesCurrency &&
                            foodBeverageChargesAmount == other.foodBeverageChargesAmount &&
                            foodBeverageChargesCurrency == other.foodBeverageChargesCurrency &&
                            noShowIndicator == other.noShowIndicator &&
                            prepaidExpensesAmount == other.prepaidExpensesAmount &&
                            prepaidExpensesCurrency == other.prepaidExpensesCurrency &&
                            roomNights == other.roomNights &&
                            totalRoomTaxAmount == other.totalRoomTaxAmount &&
                            totalRoomTaxCurrency == other.totalRoomTaxCurrency &&
                            totalTaxAmount == other.totalTaxAmount &&
                            totalTaxCurrency == other.totalTaxCurrency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            checkInDate,
                            dailyRoomRateAmount,
                            dailyRoomRateCurrency,
                            extraCharges,
                            folioCashAdvancesAmount,
                            folioCashAdvancesCurrency,
                            foodBeverageChargesAmount,
                            foodBeverageChargesCurrency,
                            noShowIndicator,
                            prepaidExpensesAmount,
                            prepaidExpensesCurrency,
                            roomNights,
                            totalRoomTaxAmount,
                            totalRoomTaxCurrency,
                            totalTaxAmount,
                            totalTaxCurrency,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Lodging{checkInDate=$checkInDate, dailyRoomRateAmount=$dailyRoomRateAmount, dailyRoomRateCurrency=$dailyRoomRateCurrency, extraCharges=$extraCharges, folioCashAdvancesAmount=$folioCashAdvancesAmount, folioCashAdvancesCurrency=$folioCashAdvancesCurrency, foodBeverageChargesAmount=$foodBeverageChargesAmount, foodBeverageChargesCurrency=$foodBeverageChargesCurrency, noShowIndicator=$noShowIndicator, prepaidExpensesAmount=$prepaidExpensesAmount, prepaidExpensesCurrency=$prepaidExpensesCurrency, roomNights=$roomNights, totalRoomTaxAmount=$totalRoomTaxAmount, totalRoomTaxCurrency=$totalRoomTaxCurrency, totalTaxAmount=$totalTaxAmount, totalTaxCurrency=$totalTaxCurrency, additionalProperties=$additionalProperties}"
                }

                /** The format of the purchase identifier. */
                class PurchaseIdentifierFormat
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** Free text */
                        @JvmField val FREE_TEXT = of("free_text")

                        /** Order number */
                        @JvmField val ORDER_NUMBER = of("order_number")

                        /** Rental agreement number */
                        @JvmField val RENTAL_AGREEMENT_NUMBER = of("rental_agreement_number")

                        /** Hotel folio number */
                        @JvmField val HOTEL_FOLIO_NUMBER = of("hotel_folio_number")

                        /** Invoice number */
                        @JvmField val INVOICE_NUMBER = of("invoice_number")

                        @JvmStatic
                        fun of(value: String) = PurchaseIdentifierFormat(JsonField.of(value))
                    }

                    /** An enum containing [PurchaseIdentifierFormat]'s known values. */
                    enum class Known {
                        /** Free text */
                        FREE_TEXT,
                        /** Order number */
                        ORDER_NUMBER,
                        /** Rental agreement number */
                        RENTAL_AGREEMENT_NUMBER,
                        /** Hotel folio number */
                        HOTEL_FOLIO_NUMBER,
                        /** Invoice number */
                        INVOICE_NUMBER,
                    }

                    /**
                     * An enum containing [PurchaseIdentifierFormat]'s known values, as well as an
                     * [_UNKNOWN] member.
                     *
                     * An instance of [PurchaseIdentifierFormat] can contain an unknown value in a
                     * couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** Free text */
                        FREE_TEXT,
                        /** Order number */
                        ORDER_NUMBER,
                        /** Rental agreement number */
                        RENTAL_AGREEMENT_NUMBER,
                        /** Hotel folio number */
                        HOTEL_FOLIO_NUMBER,
                        /** Invoice number */
                        INVOICE_NUMBER,
                        /**
                         * An enum member indicating that [PurchaseIdentifierFormat] was
                         * instantiated with an unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            FREE_TEXT -> Value.FREE_TEXT
                            ORDER_NUMBER -> Value.ORDER_NUMBER
                            RENTAL_AGREEMENT_NUMBER -> Value.RENTAL_AGREEMENT_NUMBER
                            HOTEL_FOLIO_NUMBER -> Value.HOTEL_FOLIO_NUMBER
                            INVOICE_NUMBER -> Value.INVOICE_NUMBER
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            FREE_TEXT -> Known.FREE_TEXT
                            ORDER_NUMBER -> Known.ORDER_NUMBER
                            RENTAL_AGREEMENT_NUMBER -> Known.RENTAL_AGREEMENT_NUMBER
                            HOTEL_FOLIO_NUMBER -> Known.HOTEL_FOLIO_NUMBER
                            INVOICE_NUMBER -> Known.INVOICE_NUMBER
                            else ->
                                throw IncreaseInvalidDataException(
                                    "Unknown PurchaseIdentifierFormat: $value"
                                )
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): PurchaseIdentifierFormat = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is PurchaseIdentifierFormat && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** Fields specific to travel. */
                class Travel
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val ancillary: JsonField<Ancillary>,
                    private val computerizedReservationSystem: JsonField<String>,
                    private val creditReasonIndicator: JsonField<CreditReasonIndicator>,
                    private val departureDate: JsonField<LocalDate>,
                    private val originationCityAirportCode: JsonField<String>,
                    private val passengerName: JsonField<String>,
                    private val restrictedTicketIndicator: JsonField<RestrictedTicketIndicator>,
                    private val ticketChangeIndicator: JsonField<TicketChangeIndicator>,
                    private val ticketNumber: JsonField<String>,
                    private val travelAgencyCode: JsonField<String>,
                    private val travelAgencyName: JsonField<String>,
                    private val tripLegs: JsonField<List<TripLeg>>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("ancillary")
                        @ExcludeMissing
                        ancillary: JsonField<Ancillary> = JsonMissing.of(),
                        @JsonProperty("computerized_reservation_system")
                        @ExcludeMissing
                        computerizedReservationSystem: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("credit_reason_indicator")
                        @ExcludeMissing
                        creditReasonIndicator: JsonField<CreditReasonIndicator> = JsonMissing.of(),
                        @JsonProperty("departure_date")
                        @ExcludeMissing
                        departureDate: JsonField<LocalDate> = JsonMissing.of(),
                        @JsonProperty("origination_city_airport_code")
                        @ExcludeMissing
                        originationCityAirportCode: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("passenger_name")
                        @ExcludeMissing
                        passengerName: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("restricted_ticket_indicator")
                        @ExcludeMissing
                        restrictedTicketIndicator: JsonField<RestrictedTicketIndicator> =
                            JsonMissing.of(),
                        @JsonProperty("ticket_change_indicator")
                        @ExcludeMissing
                        ticketChangeIndicator: JsonField<TicketChangeIndicator> = JsonMissing.of(),
                        @JsonProperty("ticket_number")
                        @ExcludeMissing
                        ticketNumber: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("travel_agency_code")
                        @ExcludeMissing
                        travelAgencyCode: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("travel_agency_name")
                        @ExcludeMissing
                        travelAgencyName: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("trip_legs")
                        @ExcludeMissing
                        tripLegs: JsonField<List<TripLeg>> = JsonMissing.of(),
                    ) : this(
                        ancillary,
                        computerizedReservationSystem,
                        creditReasonIndicator,
                        departureDate,
                        originationCityAirportCode,
                        passengerName,
                        restrictedTicketIndicator,
                        ticketChangeIndicator,
                        ticketNumber,
                        travelAgencyCode,
                        travelAgencyName,
                        tripLegs,
                        mutableMapOf(),
                    )

                    /**
                     * Ancillary purchases in addition to the airfare.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun ancillary(): Optional<Ancillary> = ancillary.getOptional("ancillary")

                    /**
                     * Indicates the computerized reservation system used to book the ticket.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun computerizedReservationSystem(): Optional<String> =
                        computerizedReservationSystem.getOptional("computerized_reservation_system")

                    /**
                     * Indicates the reason for a credit to the cardholder.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun creditReasonIndicator(): Optional<CreditReasonIndicator> =
                        creditReasonIndicator.getOptional("credit_reason_indicator")

                    /**
                     * Date of departure.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun departureDate(): Optional<LocalDate> =
                        departureDate.getOptional("departure_date")

                    /**
                     * Code for the originating city or airport.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun originationCityAirportCode(): Optional<String> =
                        originationCityAirportCode.getOptional("origination_city_airport_code")

                    /**
                     * Name of the passenger.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun passengerName(): Optional<String> =
                        passengerName.getOptional("passenger_name")

                    /**
                     * Indicates whether this ticket is non-refundable.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun restrictedTicketIndicator(): Optional<RestrictedTicketIndicator> =
                        restrictedTicketIndicator.getOptional("restricted_ticket_indicator")

                    /**
                     * Indicates why a ticket was changed.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun ticketChangeIndicator(): Optional<TicketChangeIndicator> =
                        ticketChangeIndicator.getOptional("ticket_change_indicator")

                    /**
                     * Ticket number.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun ticketNumber(): Optional<String> = ticketNumber.getOptional("ticket_number")

                    /**
                     * Code for the travel agency if the ticket was issued by a travel agency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun travelAgencyCode(): Optional<String> =
                        travelAgencyCode.getOptional("travel_agency_code")

                    /**
                     * Name of the travel agency if the ticket was issued by a travel agency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun travelAgencyName(): Optional<String> =
                        travelAgencyName.getOptional("travel_agency_name")

                    /**
                     * Fields specific to each leg of the journey.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun tripLegs(): Optional<List<TripLeg>> = tripLegs.getOptional("trip_legs")

                    /**
                     * Returns the raw JSON value of [ancillary].
                     *
                     * Unlike [ancillary], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("ancillary")
                    @ExcludeMissing
                    fun _ancillary(): JsonField<Ancillary> = ancillary

                    /**
                     * Returns the raw JSON value of [computerizedReservationSystem].
                     *
                     * Unlike [computerizedReservationSystem], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("computerized_reservation_system")
                    @ExcludeMissing
                    fun _computerizedReservationSystem(): JsonField<String> =
                        computerizedReservationSystem

                    /**
                     * Returns the raw JSON value of [creditReasonIndicator].
                     *
                     * Unlike [creditReasonIndicator], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("credit_reason_indicator")
                    @ExcludeMissing
                    fun _creditReasonIndicator(): JsonField<CreditReasonIndicator> =
                        creditReasonIndicator

                    /**
                     * Returns the raw JSON value of [departureDate].
                     *
                     * Unlike [departureDate], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("departure_date")
                    @ExcludeMissing
                    fun _departureDate(): JsonField<LocalDate> = departureDate

                    /**
                     * Returns the raw JSON value of [originationCityAirportCode].
                     *
                     * Unlike [originationCityAirportCode], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("origination_city_airport_code")
                    @ExcludeMissing
                    fun _originationCityAirportCode(): JsonField<String> =
                        originationCityAirportCode

                    /**
                     * Returns the raw JSON value of [passengerName].
                     *
                     * Unlike [passengerName], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("passenger_name")
                    @ExcludeMissing
                    fun _passengerName(): JsonField<String> = passengerName

                    /**
                     * Returns the raw JSON value of [restrictedTicketIndicator].
                     *
                     * Unlike [restrictedTicketIndicator], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("restricted_ticket_indicator")
                    @ExcludeMissing
                    fun _restrictedTicketIndicator(): JsonField<RestrictedTicketIndicator> =
                        restrictedTicketIndicator

                    /**
                     * Returns the raw JSON value of [ticketChangeIndicator].
                     *
                     * Unlike [ticketChangeIndicator], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("ticket_change_indicator")
                    @ExcludeMissing
                    fun _ticketChangeIndicator(): JsonField<TicketChangeIndicator> =
                        ticketChangeIndicator

                    /**
                     * Returns the raw JSON value of [ticketNumber].
                     *
                     * Unlike [ticketNumber], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("ticket_number")
                    @ExcludeMissing
                    fun _ticketNumber(): JsonField<String> = ticketNumber

                    /**
                     * Returns the raw JSON value of [travelAgencyCode].
                     *
                     * Unlike [travelAgencyCode], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("travel_agency_code")
                    @ExcludeMissing
                    fun _travelAgencyCode(): JsonField<String> = travelAgencyCode

                    /**
                     * Returns the raw JSON value of [travelAgencyName].
                     *
                     * Unlike [travelAgencyName], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("travel_agency_name")
                    @ExcludeMissing
                    fun _travelAgencyName(): JsonField<String> = travelAgencyName

                    /**
                     * Returns the raw JSON value of [tripLegs].
                     *
                     * Unlike [tripLegs], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("trip_legs")
                    @ExcludeMissing
                    fun _tripLegs(): JsonField<List<TripLeg>> = tripLegs

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Travel].
                         *
                         * The following fields are required:
                         * ```java
                         * .ancillary()
                         * .computerizedReservationSystem()
                         * .creditReasonIndicator()
                         * .departureDate()
                         * .originationCityAirportCode()
                         * .passengerName()
                         * .restrictedTicketIndicator()
                         * .ticketChangeIndicator()
                         * .ticketNumber()
                         * .travelAgencyCode()
                         * .travelAgencyName()
                         * .tripLegs()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Travel]. */
                    class Builder internal constructor() {

                        private var ancillary: JsonField<Ancillary>? = null
                        private var computerizedReservationSystem: JsonField<String>? = null
                        private var creditReasonIndicator: JsonField<CreditReasonIndicator>? = null
                        private var departureDate: JsonField<LocalDate>? = null
                        private var originationCityAirportCode: JsonField<String>? = null
                        private var passengerName: JsonField<String>? = null
                        private var restrictedTicketIndicator:
                            JsonField<RestrictedTicketIndicator>? =
                            null
                        private var ticketChangeIndicator: JsonField<TicketChangeIndicator>? = null
                        private var ticketNumber: JsonField<String>? = null
                        private var travelAgencyCode: JsonField<String>? = null
                        private var travelAgencyName: JsonField<String>? = null
                        private var tripLegs: JsonField<MutableList<TripLeg>>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(travel: Travel) = apply {
                            ancillary = travel.ancillary
                            computerizedReservationSystem = travel.computerizedReservationSystem
                            creditReasonIndicator = travel.creditReasonIndicator
                            departureDate = travel.departureDate
                            originationCityAirportCode = travel.originationCityAirportCode
                            passengerName = travel.passengerName
                            restrictedTicketIndicator = travel.restrictedTicketIndicator
                            ticketChangeIndicator = travel.ticketChangeIndicator
                            ticketNumber = travel.ticketNumber
                            travelAgencyCode = travel.travelAgencyCode
                            travelAgencyName = travel.travelAgencyName
                            tripLegs = travel.tripLegs.map { it.toMutableList() }
                            additionalProperties = travel.additionalProperties.toMutableMap()
                        }

                        /** Ancillary purchases in addition to the airfare. */
                        fun ancillary(ancillary: Ancillary?) =
                            ancillary(JsonField.ofNullable(ancillary))

                        /** Alias for calling [Builder.ancillary] with `ancillary.orElse(null)`. */
                        fun ancillary(ancillary: Optional<Ancillary>) =
                            ancillary(ancillary.getOrNull())

                        /**
                         * Sets [Builder.ancillary] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.ancillary] with a well-typed [Ancillary]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun ancillary(ancillary: JsonField<Ancillary>) = apply {
                            this.ancillary = ancillary
                        }

                        /**
                         * Indicates the computerized reservation system used to book the ticket.
                         */
                        fun computerizedReservationSystem(computerizedReservationSystem: String?) =
                            computerizedReservationSystem(
                                JsonField.ofNullable(computerizedReservationSystem)
                            )

                        /**
                         * Alias for calling [Builder.computerizedReservationSystem] with
                         * `computerizedReservationSystem.orElse(null)`.
                         */
                        fun computerizedReservationSystem(
                            computerizedReservationSystem: Optional<String>
                        ) = computerizedReservationSystem(computerizedReservationSystem.getOrNull())

                        /**
                         * Sets [Builder.computerizedReservationSystem] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.computerizedReservationSystem] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun computerizedReservationSystem(
                            computerizedReservationSystem: JsonField<String>
                        ) = apply {
                            this.computerizedReservationSystem = computerizedReservationSystem
                        }

                        /** Indicates the reason for a credit to the cardholder. */
                        fun creditReasonIndicator(creditReasonIndicator: CreditReasonIndicator?) =
                            creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator))

                        /**
                         * Alias for calling [Builder.creditReasonIndicator] with
                         * `creditReasonIndicator.orElse(null)`.
                         */
                        fun creditReasonIndicator(
                            creditReasonIndicator: Optional<CreditReasonIndicator>
                        ) = creditReasonIndicator(creditReasonIndicator.getOrNull())

                        /**
                         * Sets [Builder.creditReasonIndicator] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.creditReasonIndicator] with a well-typed
                         * [CreditReasonIndicator] value instead. This method is primarily for
                         * setting the field to an undocumented or not yet supported value.
                         */
                        fun creditReasonIndicator(
                            creditReasonIndicator: JsonField<CreditReasonIndicator>
                        ) = apply { this.creditReasonIndicator = creditReasonIndicator }

                        /** Date of departure. */
                        fun departureDate(departureDate: LocalDate?) =
                            departureDate(JsonField.ofNullable(departureDate))

                        /**
                         * Alias for calling [Builder.departureDate] with
                         * `departureDate.orElse(null)`.
                         */
                        fun departureDate(departureDate: Optional<LocalDate>) =
                            departureDate(departureDate.getOrNull())

                        /**
                         * Sets [Builder.departureDate] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.departureDate] with a well-typed
                         * [LocalDate] value instead. This method is primarily for setting the field
                         * to an undocumented or not yet supported value.
                         */
                        fun departureDate(departureDate: JsonField<LocalDate>) = apply {
                            this.departureDate = departureDate
                        }

                        /** Code for the originating city or airport. */
                        fun originationCityAirportCode(originationCityAirportCode: String?) =
                            originationCityAirportCode(
                                JsonField.ofNullable(originationCityAirportCode)
                            )

                        /**
                         * Alias for calling [Builder.originationCityAirportCode] with
                         * `originationCityAirportCode.orElse(null)`.
                         */
                        fun originationCityAirportCode(
                            originationCityAirportCode: Optional<String>
                        ) = originationCityAirportCode(originationCityAirportCode.getOrNull())

                        /**
                         * Sets [Builder.originationCityAirportCode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.originationCityAirportCode] with a
                         * well-typed [String] value instead. This method is primarily for setting
                         * the field to an undocumented or not yet supported value.
                         */
                        fun originationCityAirportCode(
                            originationCityAirportCode: JsonField<String>
                        ) = apply { this.originationCityAirportCode = originationCityAirportCode }

                        /** Name of the passenger. */
                        fun passengerName(passengerName: String?) =
                            passengerName(JsonField.ofNullable(passengerName))

                        /**
                         * Alias for calling [Builder.passengerName] with
                         * `passengerName.orElse(null)`.
                         */
                        fun passengerName(passengerName: Optional<String>) =
                            passengerName(passengerName.getOrNull())

                        /**
                         * Sets [Builder.passengerName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.passengerName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun passengerName(passengerName: JsonField<String>) = apply {
                            this.passengerName = passengerName
                        }

                        /** Indicates whether this ticket is non-refundable. */
                        fun restrictedTicketIndicator(
                            restrictedTicketIndicator: RestrictedTicketIndicator?
                        ) =
                            restrictedTicketIndicator(
                                JsonField.ofNullable(restrictedTicketIndicator)
                            )

                        /**
                         * Alias for calling [Builder.restrictedTicketIndicator] with
                         * `restrictedTicketIndicator.orElse(null)`.
                         */
                        fun restrictedTicketIndicator(
                            restrictedTicketIndicator: Optional<RestrictedTicketIndicator>
                        ) = restrictedTicketIndicator(restrictedTicketIndicator.getOrNull())

                        /**
                         * Sets [Builder.restrictedTicketIndicator] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.restrictedTicketIndicator] with a
                         * well-typed [RestrictedTicketIndicator] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun restrictedTicketIndicator(
                            restrictedTicketIndicator: JsonField<RestrictedTicketIndicator>
                        ) = apply { this.restrictedTicketIndicator = restrictedTicketIndicator }

                        /** Indicates why a ticket was changed. */
                        fun ticketChangeIndicator(ticketChangeIndicator: TicketChangeIndicator?) =
                            ticketChangeIndicator(JsonField.ofNullable(ticketChangeIndicator))

                        /**
                         * Alias for calling [Builder.ticketChangeIndicator] with
                         * `ticketChangeIndicator.orElse(null)`.
                         */
                        fun ticketChangeIndicator(
                            ticketChangeIndicator: Optional<TicketChangeIndicator>
                        ) = ticketChangeIndicator(ticketChangeIndicator.getOrNull())

                        /**
                         * Sets [Builder.ticketChangeIndicator] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.ticketChangeIndicator] with a well-typed
                         * [TicketChangeIndicator] value instead. This method is primarily for
                         * setting the field to an undocumented or not yet supported value.
                         */
                        fun ticketChangeIndicator(
                            ticketChangeIndicator: JsonField<TicketChangeIndicator>
                        ) = apply { this.ticketChangeIndicator = ticketChangeIndicator }

                        /** Ticket number. */
                        fun ticketNumber(ticketNumber: String?) =
                            ticketNumber(JsonField.ofNullable(ticketNumber))

                        /**
                         * Alias for calling [Builder.ticketNumber] with
                         * `ticketNumber.orElse(null)`.
                         */
                        fun ticketNumber(ticketNumber: Optional<String>) =
                            ticketNumber(ticketNumber.getOrNull())

                        /**
                         * Sets [Builder.ticketNumber] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.ticketNumber] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun ticketNumber(ticketNumber: JsonField<String>) = apply {
                            this.ticketNumber = ticketNumber
                        }

                        /**
                         * Code for the travel agency if the ticket was issued by a travel agency.
                         */
                        fun travelAgencyCode(travelAgencyCode: String?) =
                            travelAgencyCode(JsonField.ofNullable(travelAgencyCode))

                        /**
                         * Alias for calling [Builder.travelAgencyCode] with
                         * `travelAgencyCode.orElse(null)`.
                         */
                        fun travelAgencyCode(travelAgencyCode: Optional<String>) =
                            travelAgencyCode(travelAgencyCode.getOrNull())

                        /**
                         * Sets [Builder.travelAgencyCode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.travelAgencyCode] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun travelAgencyCode(travelAgencyCode: JsonField<String>) = apply {
                            this.travelAgencyCode = travelAgencyCode
                        }

                        /**
                         * Name of the travel agency if the ticket was issued by a travel agency.
                         */
                        fun travelAgencyName(travelAgencyName: String?) =
                            travelAgencyName(JsonField.ofNullable(travelAgencyName))

                        /**
                         * Alias for calling [Builder.travelAgencyName] with
                         * `travelAgencyName.orElse(null)`.
                         */
                        fun travelAgencyName(travelAgencyName: Optional<String>) =
                            travelAgencyName(travelAgencyName.getOrNull())

                        /**
                         * Sets [Builder.travelAgencyName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.travelAgencyName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun travelAgencyName(travelAgencyName: JsonField<String>) = apply {
                            this.travelAgencyName = travelAgencyName
                        }

                        /** Fields specific to each leg of the journey. */
                        fun tripLegs(tripLegs: List<TripLeg>?) =
                            tripLegs(JsonField.ofNullable(tripLegs))

                        /** Alias for calling [Builder.tripLegs] with `tripLegs.orElse(null)`. */
                        fun tripLegs(tripLegs: Optional<List<TripLeg>>) =
                            tripLegs(tripLegs.getOrNull())

                        /**
                         * Sets [Builder.tripLegs] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.tripLegs] with a well-typed
                         * `List<TripLeg>` value instead. This method is primarily for setting the
                         * field to an undocumented or not yet supported value.
                         */
                        fun tripLegs(tripLegs: JsonField<List<TripLeg>>) = apply {
                            this.tripLegs = tripLegs.map { it.toMutableList() }
                        }

                        /**
                         * Adds a single [TripLeg] to [tripLegs].
                         *
                         * @throws IllegalStateException if the field was previously set to a
                         *   non-list.
                         */
                        fun addTripLeg(tripLeg: TripLeg) = apply {
                            tripLegs =
                                (tripLegs ?: JsonField.of(mutableListOf())).also {
                                    checkKnown("tripLegs", it).add(tripLeg)
                                }
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Travel].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .ancillary()
                         * .computerizedReservationSystem()
                         * .creditReasonIndicator()
                         * .departureDate()
                         * .originationCityAirportCode()
                         * .passengerName()
                         * .restrictedTicketIndicator()
                         * .ticketChangeIndicator()
                         * .ticketNumber()
                         * .travelAgencyCode()
                         * .travelAgencyName()
                         * .tripLegs()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Travel =
                            Travel(
                                checkRequired("ancillary", ancillary),
                                checkRequired(
                                    "computerizedReservationSystem",
                                    computerizedReservationSystem,
                                ),
                                checkRequired("creditReasonIndicator", creditReasonIndicator),
                                checkRequired("departureDate", departureDate),
                                checkRequired(
                                    "originationCityAirportCode",
                                    originationCityAirportCode,
                                ),
                                checkRequired("passengerName", passengerName),
                                checkRequired(
                                    "restrictedTicketIndicator",
                                    restrictedTicketIndicator,
                                ),
                                checkRequired("ticketChangeIndicator", ticketChangeIndicator),
                                checkRequired("ticketNumber", ticketNumber),
                                checkRequired("travelAgencyCode", travelAgencyCode),
                                checkRequired("travelAgencyName", travelAgencyName),
                                checkRequired("tripLegs", tripLegs).map { it.toImmutable() },
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Travel = apply {
                        if (validated) {
                            return@apply
                        }

                        ancillary().ifPresent { it.validate() }
                        computerizedReservationSystem()
                        creditReasonIndicator().ifPresent { it.validate() }
                        departureDate()
                        originationCityAirportCode()
                        passengerName()
                        restrictedTicketIndicator().ifPresent { it.validate() }
                        ticketChangeIndicator().ifPresent { it.validate() }
                        ticketNumber()
                        travelAgencyCode()
                        travelAgencyName()
                        tripLegs().ifPresent { it.forEach { it.validate() } }
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (ancillary.asKnown().getOrNull()?.validity() ?: 0) +
                            (if (computerizedReservationSystem.asKnown().isPresent) 1 else 0) +
                            (creditReasonIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                            (if (departureDate.asKnown().isPresent) 1 else 0) +
                            (if (originationCityAirportCode.asKnown().isPresent) 1 else 0) +
                            (if (passengerName.asKnown().isPresent) 1 else 0) +
                            (restrictedTicketIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                            (ticketChangeIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                            (if (ticketNumber.asKnown().isPresent) 1 else 0) +
                            (if (travelAgencyCode.asKnown().isPresent) 1 else 0) +
                            (if (travelAgencyName.asKnown().isPresent) 1 else 0) +
                            (tripLegs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)

                    /** Ancillary purchases in addition to the airfare. */
                    class Ancillary
                    @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                    private constructor(
                        private val connectedTicketDocumentNumber: JsonField<String>,
                        private val creditReasonIndicator: JsonField<CreditReasonIndicator>,
                        private val passengerNameOrDescription: JsonField<String>,
                        private val services: JsonField<List<Service>>,
                        private val ticketDocumentNumber: JsonField<String>,
                        private val additionalProperties: MutableMap<String, JsonValue>,
                    ) {

                        @JsonCreator
                        private constructor(
                            @JsonProperty("connected_ticket_document_number")
                            @ExcludeMissing
                            connectedTicketDocumentNumber: JsonField<String> = JsonMissing.of(),
                            @JsonProperty("credit_reason_indicator")
                            @ExcludeMissing
                            creditReasonIndicator: JsonField<CreditReasonIndicator> =
                                JsonMissing.of(),
                            @JsonProperty("passenger_name_or_description")
                            @ExcludeMissing
                            passengerNameOrDescription: JsonField<String> = JsonMissing.of(),
                            @JsonProperty("services")
                            @ExcludeMissing
                            services: JsonField<List<Service>> = JsonMissing.of(),
                            @JsonProperty("ticket_document_number")
                            @ExcludeMissing
                            ticketDocumentNumber: JsonField<String> = JsonMissing.of(),
                        ) : this(
                            connectedTicketDocumentNumber,
                            creditReasonIndicator,
                            passengerNameOrDescription,
                            services,
                            ticketDocumentNumber,
                            mutableMapOf(),
                        )

                        /**
                         * If this purchase has a connection or relationship to another purchase,
                         * such as a baggage fee for a passenger transport ticket, this field should
                         * contain the ticket document number for the other purchase.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun connectedTicketDocumentNumber(): Optional<String> =
                            connectedTicketDocumentNumber.getOptional(
                                "connected_ticket_document_number"
                            )

                        /**
                         * Indicates the reason for a credit to the cardholder.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun creditReasonIndicator(): Optional<CreditReasonIndicator> =
                            creditReasonIndicator.getOptional("credit_reason_indicator")

                        /**
                         * Name of the passenger or description of the ancillary purchase.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun passengerNameOrDescription(): Optional<String> =
                            passengerNameOrDescription.getOptional("passenger_name_or_description")

                        /**
                         * Additional travel charges, such as baggage fees.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type or is unexpectedly missing or null (e.g. if the server responded
                         *   with an unexpected value).
                         */
                        fun services(): List<Service> = services.getRequired("services")

                        /**
                         * Ticket document number.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun ticketDocumentNumber(): Optional<String> =
                            ticketDocumentNumber.getOptional("ticket_document_number")

                        /**
                         * Returns the raw JSON value of [connectedTicketDocumentNumber].
                         *
                         * Unlike [connectedTicketDocumentNumber], this method doesn't throw if the
                         * JSON field has an unexpected type.
                         */
                        @JsonProperty("connected_ticket_document_number")
                        @ExcludeMissing
                        fun _connectedTicketDocumentNumber(): JsonField<String> =
                            connectedTicketDocumentNumber

                        /**
                         * Returns the raw JSON value of [creditReasonIndicator].
                         *
                         * Unlike [creditReasonIndicator], this method doesn't throw if the JSON
                         * field has an unexpected type.
                         */
                        @JsonProperty("credit_reason_indicator")
                        @ExcludeMissing
                        fun _creditReasonIndicator(): JsonField<CreditReasonIndicator> =
                            creditReasonIndicator

                        /**
                         * Returns the raw JSON value of [passengerNameOrDescription].
                         *
                         * Unlike [passengerNameOrDescription], this method doesn't throw if the
                         * JSON field has an unexpected type.
                         */
                        @JsonProperty("passenger_name_or_description")
                        @ExcludeMissing
                        fun _passengerNameOrDescription(): JsonField<String> =
                            passengerNameOrDescription

                        /**
                         * Returns the raw JSON value of [services].
                         *
                         * Unlike [services], this method doesn't throw if the JSON field has an
                         * unexpected type.
                         */
                        @JsonProperty("services")
                        @ExcludeMissing
                        fun _services(): JsonField<List<Service>> = services

                        /**
                         * Returns the raw JSON value of [ticketDocumentNumber].
                         *
                         * Unlike [ticketDocumentNumber], this method doesn't throw if the JSON
                         * field has an unexpected type.
                         */
                        @JsonProperty("ticket_document_number")
                        @ExcludeMissing
                        fun _ticketDocumentNumber(): JsonField<String> = ticketDocumentNumber

                        @JsonAnySetter
                        private fun putAdditionalProperty(key: String, value: JsonValue) {
                            additionalProperties.put(key, value)
                        }

                        @JsonAnyGetter
                        @ExcludeMissing
                        fun _additionalProperties(): Map<String, JsonValue> =
                            Collections.unmodifiableMap(additionalProperties)

                        fun toBuilder() = Builder().from(this)

                        companion object {

                            /**
                             * Returns a mutable builder for constructing an instance of
                             * [Ancillary].
                             *
                             * The following fields are required:
                             * ```java
                             * .connectedTicketDocumentNumber()
                             * .creditReasonIndicator()
                             * .passengerNameOrDescription()
                             * .services()
                             * .ticketDocumentNumber()
                             * ```
                             */
                            @JvmStatic fun builder() = Builder()
                        }

                        /** A builder for [Ancillary]. */
                        class Builder internal constructor() {

                            private var connectedTicketDocumentNumber: JsonField<String>? = null
                            private var creditReasonIndicator: JsonField<CreditReasonIndicator>? =
                                null
                            private var passengerNameOrDescription: JsonField<String>? = null
                            private var services: JsonField<MutableList<Service>>? = null
                            private var ticketDocumentNumber: JsonField<String>? = null
                            private var additionalProperties: MutableMap<String, JsonValue> =
                                mutableMapOf()

                            @JvmSynthetic
                            internal fun from(ancillary: Ancillary) = apply {
                                connectedTicketDocumentNumber =
                                    ancillary.connectedTicketDocumentNumber
                                creditReasonIndicator = ancillary.creditReasonIndicator
                                passengerNameOrDescription = ancillary.passengerNameOrDescription
                                services = ancillary.services.map { it.toMutableList() }
                                ticketDocumentNumber = ancillary.ticketDocumentNumber
                                additionalProperties = ancillary.additionalProperties.toMutableMap()
                            }

                            /**
                             * If this purchase has a connection or relationship to another
                             * purchase, such as a baggage fee for a passenger transport ticket,
                             * this field should contain the ticket document number for the other
                             * purchase.
                             */
                            fun connectedTicketDocumentNumber(
                                connectedTicketDocumentNumber: String?
                            ) =
                                connectedTicketDocumentNumber(
                                    JsonField.ofNullable(connectedTicketDocumentNumber)
                                )

                            /**
                             * Alias for calling [Builder.connectedTicketDocumentNumber] with
                             * `connectedTicketDocumentNumber.orElse(null)`.
                             */
                            fun connectedTicketDocumentNumber(
                                connectedTicketDocumentNumber: Optional<String>
                            ) =
                                connectedTicketDocumentNumber(
                                    connectedTicketDocumentNumber.getOrNull()
                                )

                            /**
                             * Sets [Builder.connectedTicketDocumentNumber] to an arbitrary JSON
                             * value.
                             *
                             * You should usually call [Builder.connectedTicketDocumentNumber] with
                             * a well-typed [String] value instead. This method is primarily for
                             * setting the field to an undocumented or not yet supported value.
                             */
                            fun connectedTicketDocumentNumber(
                                connectedTicketDocumentNumber: JsonField<String>
                            ) = apply {
                                this.connectedTicketDocumentNumber = connectedTicketDocumentNumber
                            }

                            /** Indicates the reason for a credit to the cardholder. */
                            fun creditReasonIndicator(
                                creditReasonIndicator: CreditReasonIndicator?
                            ) = creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator))

                            /**
                             * Alias for calling [Builder.creditReasonIndicator] with
                             * `creditReasonIndicator.orElse(null)`.
                             */
                            fun creditReasonIndicator(
                                creditReasonIndicator: Optional<CreditReasonIndicator>
                            ) = creditReasonIndicator(creditReasonIndicator.getOrNull())

                            /**
                             * Sets [Builder.creditReasonIndicator] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.creditReasonIndicator] with a
                             * well-typed [CreditReasonIndicator] value instead. This method is
                             * primarily for setting the field to an undocumented or not yet
                             * supported value.
                             */
                            fun creditReasonIndicator(
                                creditReasonIndicator: JsonField<CreditReasonIndicator>
                            ) = apply { this.creditReasonIndicator = creditReasonIndicator }

                            /** Name of the passenger or description of the ancillary purchase. */
                            fun passengerNameOrDescription(passengerNameOrDescription: String?) =
                                passengerNameOrDescription(
                                    JsonField.ofNullable(passengerNameOrDescription)
                                )

                            /**
                             * Alias for calling [Builder.passengerNameOrDescription] with
                             * `passengerNameOrDescription.orElse(null)`.
                             */
                            fun passengerNameOrDescription(
                                passengerNameOrDescription: Optional<String>
                            ) = passengerNameOrDescription(passengerNameOrDescription.getOrNull())

                            /**
                             * Sets [Builder.passengerNameOrDescription] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.passengerNameOrDescription] with a
                             * well-typed [String] value instead. This method is primarily for
                             * setting the field to an undocumented or not yet supported value.
                             */
                            fun passengerNameOrDescription(
                                passengerNameOrDescription: JsonField<String>
                            ) = apply {
                                this.passengerNameOrDescription = passengerNameOrDescription
                            }

                            /** Additional travel charges, such as baggage fees. */
                            fun services(services: List<Service>) = services(JsonField.of(services))

                            /**
                             * Sets [Builder.services] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.services] with a well-typed
                             * `List<Service>` value instead. This method is primarily for setting
                             * the field to an undocumented or not yet supported value.
                             */
                            fun services(services: JsonField<List<Service>>) = apply {
                                this.services = services.map { it.toMutableList() }
                            }

                            /**
                             * Adds a single [Service] to [services].
                             *
                             * @throws IllegalStateException if the field was previously set to a
                             *   non-list.
                             */
                            fun addService(service: Service) = apply {
                                services =
                                    (services ?: JsonField.of(mutableListOf())).also {
                                        checkKnown("services", it).add(service)
                                    }
                            }

                            /** Ticket document number. */
                            fun ticketDocumentNumber(ticketDocumentNumber: String?) =
                                ticketDocumentNumber(JsonField.ofNullable(ticketDocumentNumber))

                            /**
                             * Alias for calling [Builder.ticketDocumentNumber] with
                             * `ticketDocumentNumber.orElse(null)`.
                             */
                            fun ticketDocumentNumber(ticketDocumentNumber: Optional<String>) =
                                ticketDocumentNumber(ticketDocumentNumber.getOrNull())

                            /**
                             * Sets [Builder.ticketDocumentNumber] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.ticketDocumentNumber] with a
                             * well-typed [String] value instead. This method is primarily for
                             * setting the field to an undocumented or not yet supported value.
                             */
                            fun ticketDocumentNumber(ticketDocumentNumber: JsonField<String>) =
                                apply {
                                    this.ticketDocumentNumber = ticketDocumentNumber
                                }

                            fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                                apply {
                                    this.additionalProperties.clear()
                                    putAllAdditionalProperties(additionalProperties)
                                }

                            fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                                additionalProperties.put(key, value)
                            }

                            fun putAllAdditionalProperties(
                                additionalProperties: Map<String, JsonValue>
                            ) = apply { this.additionalProperties.putAll(additionalProperties) }

                            fun removeAdditionalProperty(key: String) = apply {
                                additionalProperties.remove(key)
                            }

                            fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                                keys.forEach(::removeAdditionalProperty)
                            }

                            /**
                             * Returns an immutable instance of [Ancillary].
                             *
                             * Further updates to this [Builder] will not mutate the returned
                             * instance.
                             *
                             * The following fields are required:
                             * ```java
                             * .connectedTicketDocumentNumber()
                             * .creditReasonIndicator()
                             * .passengerNameOrDescription()
                             * .services()
                             * .ticketDocumentNumber()
                             * ```
                             *
                             * @throws IllegalStateException if any required field is unset.
                             */
                            fun build(): Ancillary =
                                Ancillary(
                                    checkRequired(
                                        "connectedTicketDocumentNumber",
                                        connectedTicketDocumentNumber,
                                    ),
                                    checkRequired("creditReasonIndicator", creditReasonIndicator),
                                    checkRequired(
                                        "passengerNameOrDescription",
                                        passengerNameOrDescription,
                                    ),
                                    checkRequired("services", services).map { it.toImmutable() },
                                    checkRequired("ticketDocumentNumber", ticketDocumentNumber),
                                    additionalProperties.toMutableMap(),
                                )
                        }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): Ancillary = apply {
                            if (validated) {
                                return@apply
                            }

                            connectedTicketDocumentNumber()
                            creditReasonIndicator().ifPresent { it.validate() }
                            passengerNameOrDescription()
                            services().forEach { it.validate() }
                            ticketDocumentNumber()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int =
                            (if (connectedTicketDocumentNumber.asKnown().isPresent) 1 else 0) +
                                (creditReasonIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                                (if (passengerNameOrDescription.asKnown().isPresent) 1 else 0) +
                                (services.asKnown().getOrNull()?.sumOf { it.validity().toInt() }
                                    ?: 0) +
                                (if (ticketDocumentNumber.asKnown().isPresent) 1 else 0)

                        /** Indicates the reason for a credit to the cardholder. */
                        class CreditReasonIndicator
                        @JsonCreator
                        private constructor(private val value: JsonField<String>) : Enum {

                            /**
                             * Returns this class instance's raw value.
                             *
                             * This is usually only useful if this instance was deserialized from
                             * data that doesn't match any known member, and you want to know that
                             * value. For example, if the SDK is on an older version than the API,
                             * then the API may respond with new members that the SDK is unaware of.
                             */
                            @com.fasterxml.jackson.annotation.JsonValue
                            fun _value(): JsonField<String> = value

                            companion object {

                                /** No credit */
                                @JvmField val NO_CREDIT = of("no_credit")

                                /** Passenger transport ancillary purchase cancellation */
                                @JvmField
                                val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION =
                                    of("passenger_transport_ancillary_purchase_cancellation")

                                /**
                                 * Airline ticket and passenger transport ancillary purchase
                                 * cancellation
                                 */
                                @JvmField
                                val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION =
                                    of(
                                        "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation"
                                    )

                                /** Other */
                                @JvmField val OTHER = of("other")

                                @JvmStatic
                                fun of(value: String) = CreditReasonIndicator(JsonField.of(value))
                            }

                            /** An enum containing [CreditReasonIndicator]'s known values. */
                            enum class Known {
                                /** No credit */
                                NO_CREDIT,
                                /** Passenger transport ancillary purchase cancellation */
                                PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION,
                                /**
                                 * Airline ticket and passenger transport ancillary purchase
                                 * cancellation
                                 */
                                AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION,
                                /** Other */
                                OTHER,
                            }

                            /**
                             * An enum containing [CreditReasonIndicator]'s known values, as well as
                             * an [_UNKNOWN] member.
                             *
                             * An instance of [CreditReasonIndicator] can contain an unknown value
                             * in a couple of cases:
                             * - It was deserialized from data that doesn't match any known member.
                             *   For example, if the SDK is on an older version than the API, then
                             *   the API may respond with new members that the SDK is unaware of.
                             * - It was constructed with an arbitrary value using the [of] method.
                             */
                            enum class Value {
                                /** No credit */
                                NO_CREDIT,
                                /** Passenger transport ancillary purchase cancellation */
                                PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION,
                                /**
                                 * Airline ticket and passenger transport ancillary purchase
                                 * cancellation
                                 */
                                AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION,
                                /** Other */
                                OTHER,
                                /**
                                 * An enum member indicating that [CreditReasonIndicator] was
                                 * instantiated with an unknown value.
                                 */
                                _UNKNOWN,
                            }

                            /**
                             * Returns an enum member corresponding to this class instance's value,
                             * or [Value._UNKNOWN] if the class was instantiated with an unknown
                             * value.
                             *
                             * Use the [known] method instead if you're certain the value is always
                             * known or if you want to throw for the unknown case.
                             */
                            fun value(): Value =
                                when (this) {
                                    NO_CREDIT -> Value.NO_CREDIT
                                    PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION ->
                                        Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION
                                    AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION ->
                                        Value
                                            .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION
                                    OTHER -> Value.OTHER
                                    else -> Value._UNKNOWN
                                }

                            /**
                             * Returns an enum member corresponding to this class instance's value.
                             *
                             * Use the [value] method instead if you're uncertain the value is
                             * always known and don't want to throw for the unknown case.
                             *
                             * @throws IncreaseInvalidDataException if this class instance's value
                             *   is a not a known member.
                             */
                            fun known(): Known =
                                when (this) {
                                    NO_CREDIT -> Known.NO_CREDIT
                                    PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION ->
                                        Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION
                                    AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION ->
                                        Known
                                            .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION
                                    OTHER -> Known.OTHER
                                    else ->
                                        throw IncreaseInvalidDataException(
                                            "Unknown CreditReasonIndicator: $value"
                                        )
                                }

                            /**
                             * Returns this class instance's primitive wire representation.
                             *
                             * This differs from the [toString] method because that method is
                             * primarily for debugging and generally doesn't throw.
                             *
                             * @throws IncreaseInvalidDataException if this class instance's value
                             *   does not have the expected primitive type.
                             */
                            fun asString(): String =
                                _value().asString().orElseThrow {
                                    IncreaseInvalidDataException("Value is not a String")
                                }

                            private var validated: Boolean = false

                            /**
                             * Validates that the types of all values in this object match their
                             * expected types recursively.
                             *
                             * This method is _not_ forwards compatible with new types from the API
                             * for existing fields.
                             *
                             * @throws IncreaseInvalidDataException if any value type in this object
                             *   doesn't match its expected type.
                             */
                            fun validate(): CreditReasonIndicator = apply {
                                if (validated) {
                                    return@apply
                                }

                                known()
                                validated = true
                            }

                            fun isValid(): Boolean =
                                try {
                                    validate()
                                    true
                                } catch (e: IncreaseInvalidDataException) {
                                    false
                                }

                            /**
                             * Returns a score indicating how many valid values are contained in
                             * this object recursively.
                             *
                             * Used for best match union deserialization.
                             */
                            @JvmSynthetic
                            internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                            override fun equals(other: Any?): Boolean {
                                if (this === other) {
                                    return true
                                }

                                return other is CreditReasonIndicator && value == other.value
                            }

                            override fun hashCode() = value.hashCode()

                            override fun toString() = value.toString()
                        }

                        class Service
                        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                        private constructor(
                            private val category: JsonField<Category>,
                            private val subCategory: JsonField<String>,
                            private val additionalProperties: MutableMap<String, JsonValue>,
                        ) {

                            @JsonCreator
                            private constructor(
                                @JsonProperty("category")
                                @ExcludeMissing
                                category: JsonField<Category> = JsonMissing.of(),
                                @JsonProperty("sub_category")
                                @ExcludeMissing
                                subCategory: JsonField<String> = JsonMissing.of(),
                            ) : this(category, subCategory, mutableMapOf())

                            /**
                             * Category of the ancillary service.
                             *
                             * @throws IncreaseInvalidDataException if the JSON field has an
                             *   unexpected type (e.g. if the server responded with an unexpected
                             *   value).
                             */
                            fun category(): Optional<Category> = category.getOptional("category")

                            /**
                             * Sub-category of the ancillary service, free-form.
                             *
                             * @throws IncreaseInvalidDataException if the JSON field has an
                             *   unexpected type (e.g. if the server responded with an unexpected
                             *   value).
                             */
                            fun subCategory(): Optional<String> =
                                subCategory.getOptional("sub_category")

                            /**
                             * Returns the raw JSON value of [category].
                             *
                             * Unlike [category], this method doesn't throw if the JSON field has an
                             * unexpected type.
                             */
                            @JsonProperty("category")
                            @ExcludeMissing
                            fun _category(): JsonField<Category> = category

                            /**
                             * Returns the raw JSON value of [subCategory].
                             *
                             * Unlike [subCategory], this method doesn't throw if the JSON field has
                             * an unexpected type.
                             */
                            @JsonProperty("sub_category")
                            @ExcludeMissing
                            fun _subCategory(): JsonField<String> = subCategory

                            @JsonAnySetter
                            private fun putAdditionalProperty(key: String, value: JsonValue) {
                                additionalProperties.put(key, value)
                            }

                            @JsonAnyGetter
                            @ExcludeMissing
                            fun _additionalProperties(): Map<String, JsonValue> =
                                Collections.unmodifiableMap(additionalProperties)

                            fun toBuilder() = Builder().from(this)

                            companion object {

                                /**
                                 * Returns a mutable builder for constructing an instance of
                                 * [Service].
                                 *
                                 * The following fields are required:
                                 * ```java
                                 * .category()
                                 * .subCategory()
                                 * ```
                                 */
                                @JvmStatic fun builder() = Builder()
                            }

                            /** A builder for [Service]. */
                            class Builder internal constructor() {

                                private var category: JsonField<Category>? = null
                                private var subCategory: JsonField<String>? = null
                                private var additionalProperties: MutableMap<String, JsonValue> =
                                    mutableMapOf()

                                @JvmSynthetic
                                internal fun from(service: Service) = apply {
                                    category = service.category
                                    subCategory = service.subCategory
                                    additionalProperties =
                                        service.additionalProperties.toMutableMap()
                                }

                                /** Category of the ancillary service. */
                                fun category(category: Category?) =
                                    category(JsonField.ofNullable(category))

                                /**
                                 * Alias for calling [Builder.category] with
                                 * `category.orElse(null)`.
                                 */
                                fun category(category: Optional<Category>) =
                                    category(category.getOrNull())

                                /**
                                 * Sets [Builder.category] to an arbitrary JSON value.
                                 *
                                 * You should usually call [Builder.category] with a well-typed
                                 * [Category] value instead. This method is primarily for setting
                                 * the field to an undocumented or not yet supported value.
                                 */
                                fun category(category: JsonField<Category>) = apply {
                                    this.category = category
                                }

                                /** Sub-category of the ancillary service, free-form. */
                                fun subCategory(subCategory: String?) =
                                    subCategory(JsonField.ofNullable(subCategory))

                                /**
                                 * Alias for calling [Builder.subCategory] with
                                 * `subCategory.orElse(null)`.
                                 */
                                fun subCategory(subCategory: Optional<String>) =
                                    subCategory(subCategory.getOrNull())

                                /**
                                 * Sets [Builder.subCategory] to an arbitrary JSON value.
                                 *
                                 * You should usually call [Builder.subCategory] with a well-typed
                                 * [String] value instead. This method is primarily for setting the
                                 * field to an undocumented or not yet supported value.
                                 */
                                fun subCategory(subCategory: JsonField<String>) = apply {
                                    this.subCategory = subCategory
                                }

                                fun additionalProperties(
                                    additionalProperties: Map<String, JsonValue>
                                ) = apply {
                                    this.additionalProperties.clear()
                                    putAllAdditionalProperties(additionalProperties)
                                }

                                fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                                    additionalProperties.put(key, value)
                                }

                                fun putAllAdditionalProperties(
                                    additionalProperties: Map<String, JsonValue>
                                ) = apply { this.additionalProperties.putAll(additionalProperties) }

                                fun removeAdditionalProperty(key: String) = apply {
                                    additionalProperties.remove(key)
                                }

                                fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                                    keys.forEach(::removeAdditionalProperty)
                                }

                                /**
                                 * Returns an immutable instance of [Service].
                                 *
                                 * Further updates to this [Builder] will not mutate the returned
                                 * instance.
                                 *
                                 * The following fields are required:
                                 * ```java
                                 * .category()
                                 * .subCategory()
                                 * ```
                                 *
                                 * @throws IllegalStateException if any required field is unset.
                                 */
                                fun build(): Service =
                                    Service(
                                        checkRequired("category", category),
                                        checkRequired("subCategory", subCategory),
                                        additionalProperties.toMutableMap(),
                                    )
                            }

                            private var validated: Boolean = false

                            /**
                             * Validates that the types of all values in this object match their
                             * expected types recursively.
                             *
                             * This method is _not_ forwards compatible with new types from the API
                             * for existing fields.
                             *
                             * @throws IncreaseInvalidDataException if any value type in this object
                             *   doesn't match its expected type.
                             */
                            fun validate(): Service = apply {
                                if (validated) {
                                    return@apply
                                }

                                category().ifPresent { it.validate() }
                                subCategory()
                                validated = true
                            }

                            fun isValid(): Boolean =
                                try {
                                    validate()
                                    true
                                } catch (e: IncreaseInvalidDataException) {
                                    false
                                }

                            /**
                             * Returns a score indicating how many valid values are contained in
                             * this object recursively.
                             *
                             * Used for best match union deserialization.
                             */
                            @JvmSynthetic
                            internal fun validity(): Int =
                                (category.asKnown().getOrNull()?.validity() ?: 0) +
                                    (if (subCategory.asKnown().isPresent) 1 else 0)

                            /** Category of the ancillary service. */
                            class Category
                            @JsonCreator
                            private constructor(private val value: JsonField<String>) : Enum {

                                /**
                                 * Returns this class instance's raw value.
                                 *
                                 * This is usually only useful if this instance was deserialized
                                 * from data that doesn't match any known member, and you want to
                                 * know that value. For example, if the SDK is on an older version
                                 * than the API, then the API may respond with new members that the
                                 * SDK is unaware of.
                                 */
                                @com.fasterxml.jackson.annotation.JsonValue
                                fun _value(): JsonField<String> = value

                                companion object {

                                    /** None */
                                    @JvmField val NONE = of("none")

                                    /** Bundled service */
                                    @JvmField val BUNDLED_SERVICE = of("bundled_service")

                                    /** Baggage fee */
                                    @JvmField val BAGGAGE_FEE = of("baggage_fee")

                                    /** Change fee */
                                    @JvmField val CHANGE_FEE = of("change_fee")

                                    /** Cargo */
                                    @JvmField val CARGO = of("cargo")

                                    /** Carbon offset */
                                    @JvmField val CARBON_OFFSET = of("carbon_offset")

                                    /** Frequent flyer */
                                    @JvmField val FREQUENT_FLYER = of("frequent_flyer")

                                    /** Gift card */
                                    @JvmField val GIFT_CARD = of("gift_card")

                                    /** Ground transport */
                                    @JvmField val GROUND_TRANSPORT = of("ground_transport")

                                    /** In-flight entertainment */
                                    @JvmField
                                    val IN_FLIGHT_ENTERTAINMENT = of("in_flight_entertainment")

                                    /** Lounge */
                                    @JvmField val LOUNGE = of("lounge")

                                    /** Medical */
                                    @JvmField val MEDICAL = of("medical")

                                    /** Meal beverage */
                                    @JvmField val MEAL_BEVERAGE = of("meal_beverage")

                                    /** Other */
                                    @JvmField val OTHER = of("other")

                                    /** Passenger assist fee */
                                    @JvmField val PASSENGER_ASSIST_FEE = of("passenger_assist_fee")

                                    /** Pets */
                                    @JvmField val PETS = of("pets")

                                    /** Seat fees */
                                    @JvmField val SEAT_FEES = of("seat_fees")

                                    /** Standby */
                                    @JvmField val STANDBY = of("standby")

                                    /** Service fee */
                                    @JvmField val SERVICE_FEE = of("service_fee")

                                    /** Store */
                                    @JvmField val STORE = of("store")

                                    /** Travel service */
                                    @JvmField val TRAVEL_SERVICE = of("travel_service")

                                    /** Unaccompanied travel */
                                    @JvmField val UNACCOMPANIED_TRAVEL = of("unaccompanied_travel")

                                    /** Upgrades */
                                    @JvmField val UPGRADES = of("upgrades")

                                    /** Wi-fi */
                                    @JvmField val WIFI = of("wifi")

                                    @JvmStatic fun of(value: String) = Category(JsonField.of(value))
                                }

                                /** An enum containing [Category]'s known values. */
                                enum class Known {
                                    /** None */
                                    NONE,
                                    /** Bundled service */
                                    BUNDLED_SERVICE,
                                    /** Baggage fee */
                                    BAGGAGE_FEE,
                                    /** Change fee */
                                    CHANGE_FEE,
                                    /** Cargo */
                                    CARGO,
                                    /** Carbon offset */
                                    CARBON_OFFSET,
                                    /** Frequent flyer */
                                    FREQUENT_FLYER,
                                    /** Gift card */
                                    GIFT_CARD,
                                    /** Ground transport */
                                    GROUND_TRANSPORT,
                                    /** In-flight entertainment */
                                    IN_FLIGHT_ENTERTAINMENT,
                                    /** Lounge */
                                    LOUNGE,
                                    /** Medical */
                                    MEDICAL,
                                    /** Meal beverage */
                                    MEAL_BEVERAGE,
                                    /** Other */
                                    OTHER,
                                    /** Passenger assist fee */
                                    PASSENGER_ASSIST_FEE,
                                    /** Pets */
                                    PETS,
                                    /** Seat fees */
                                    SEAT_FEES,
                                    /** Standby */
                                    STANDBY,
                                    /** Service fee */
                                    SERVICE_FEE,
                                    /** Store */
                                    STORE,
                                    /** Travel service */
                                    TRAVEL_SERVICE,
                                    /** Unaccompanied travel */
                                    UNACCOMPANIED_TRAVEL,
                                    /** Upgrades */
                                    UPGRADES,
                                    /** Wi-fi */
                                    WIFI,
                                }

                                /**
                                 * An enum containing [Category]'s known values, as well as an
                                 * [_UNKNOWN] member.
                                 *
                                 * An instance of [Category] can contain an unknown value in a
                                 * couple of cases:
                                 * - It was deserialized from data that doesn't match any known
                                 *   member. For example, if the SDK is on an older version than the
                                 *   API, then the API may respond with new members that the SDK is
                                 *   unaware of.
                                 * - It was constructed with an arbitrary value using the [of]
                                 *   method.
                                 */
                                enum class Value {
                                    /** None */
                                    NONE,
                                    /** Bundled service */
                                    BUNDLED_SERVICE,
                                    /** Baggage fee */
                                    BAGGAGE_FEE,
                                    /** Change fee */
                                    CHANGE_FEE,
                                    /** Cargo */
                                    CARGO,
                                    /** Carbon offset */
                                    CARBON_OFFSET,
                                    /** Frequent flyer */
                                    FREQUENT_FLYER,
                                    /** Gift card */
                                    GIFT_CARD,
                                    /** Ground transport */
                                    GROUND_TRANSPORT,
                                    /** In-flight entertainment */
                                    IN_FLIGHT_ENTERTAINMENT,
                                    /** Lounge */
                                    LOUNGE,
                                    /** Medical */
                                    MEDICAL,
                                    /** Meal beverage */
                                    MEAL_BEVERAGE,
                                    /** Other */
                                    OTHER,
                                    /** Passenger assist fee */
                                    PASSENGER_ASSIST_FEE,
                                    /** Pets */
                                    PETS,
                                    /** Seat fees */
                                    SEAT_FEES,
                                    /** Standby */
                                    STANDBY,
                                    /** Service fee */
                                    SERVICE_FEE,
                                    /** Store */
                                    STORE,
                                    /** Travel service */
                                    TRAVEL_SERVICE,
                                    /** Unaccompanied travel */
                                    UNACCOMPANIED_TRAVEL,
                                    /** Upgrades */
                                    UPGRADES,
                                    /** Wi-fi */
                                    WIFI,
                                    /**
                                     * An enum member indicating that [Category] was instantiated
                                     * with an unknown value.
                                     */
                                    _UNKNOWN,
                                }

                                /**
                                 * Returns an enum member corresponding to this class instance's
                                 * value, or [Value._UNKNOWN] if the class was instantiated with an
                                 * unknown value.
                                 *
                                 * Use the [known] method instead if you're certain the value is
                                 * always known or if you want to throw for the unknown case.
                                 */
                                fun value(): Value =
                                    when (this) {
                                        NONE -> Value.NONE
                                        BUNDLED_SERVICE -> Value.BUNDLED_SERVICE
                                        BAGGAGE_FEE -> Value.BAGGAGE_FEE
                                        CHANGE_FEE -> Value.CHANGE_FEE
                                        CARGO -> Value.CARGO
                                        CARBON_OFFSET -> Value.CARBON_OFFSET
                                        FREQUENT_FLYER -> Value.FREQUENT_FLYER
                                        GIFT_CARD -> Value.GIFT_CARD
                                        GROUND_TRANSPORT -> Value.GROUND_TRANSPORT
                                        IN_FLIGHT_ENTERTAINMENT -> Value.IN_FLIGHT_ENTERTAINMENT
                                        LOUNGE -> Value.LOUNGE
                                        MEDICAL -> Value.MEDICAL
                                        MEAL_BEVERAGE -> Value.MEAL_BEVERAGE
                                        OTHER -> Value.OTHER
                                        PASSENGER_ASSIST_FEE -> Value.PASSENGER_ASSIST_FEE
                                        PETS -> Value.PETS
                                        SEAT_FEES -> Value.SEAT_FEES
                                        STANDBY -> Value.STANDBY
                                        SERVICE_FEE -> Value.SERVICE_FEE
                                        STORE -> Value.STORE
                                        TRAVEL_SERVICE -> Value.TRAVEL_SERVICE
                                        UNACCOMPANIED_TRAVEL -> Value.UNACCOMPANIED_TRAVEL
                                        UPGRADES -> Value.UPGRADES
                                        WIFI -> Value.WIFI
                                        else -> Value._UNKNOWN
                                    }

                                /**
                                 * Returns an enum member corresponding to this class instance's
                                 * value.
                                 *
                                 * Use the [value] method instead if you're uncertain the value is
                                 * always known and don't want to throw for the unknown case.
                                 *
                                 * @throws IncreaseInvalidDataException if this class instance's
                                 *   value is a not a known member.
                                 */
                                fun known(): Known =
                                    when (this) {
                                        NONE -> Known.NONE
                                        BUNDLED_SERVICE -> Known.BUNDLED_SERVICE
                                        BAGGAGE_FEE -> Known.BAGGAGE_FEE
                                        CHANGE_FEE -> Known.CHANGE_FEE
                                        CARGO -> Known.CARGO
                                        CARBON_OFFSET -> Known.CARBON_OFFSET
                                        FREQUENT_FLYER -> Known.FREQUENT_FLYER
                                        GIFT_CARD -> Known.GIFT_CARD
                                        GROUND_TRANSPORT -> Known.GROUND_TRANSPORT
                                        IN_FLIGHT_ENTERTAINMENT -> Known.IN_FLIGHT_ENTERTAINMENT
                                        LOUNGE -> Known.LOUNGE
                                        MEDICAL -> Known.MEDICAL
                                        MEAL_BEVERAGE -> Known.MEAL_BEVERAGE
                                        OTHER -> Known.OTHER
                                        PASSENGER_ASSIST_FEE -> Known.PASSENGER_ASSIST_FEE
                                        PETS -> Known.PETS
                                        SEAT_FEES -> Known.SEAT_FEES
                                        STANDBY -> Known.STANDBY
                                        SERVICE_FEE -> Known.SERVICE_FEE
                                        STORE -> Known.STORE
                                        TRAVEL_SERVICE -> Known.TRAVEL_SERVICE
                                        UNACCOMPANIED_TRAVEL -> Known.UNACCOMPANIED_TRAVEL
                                        UPGRADES -> Known.UPGRADES
                                        WIFI -> Known.WIFI
                                        else ->
                                            throw IncreaseInvalidDataException(
                                                "Unknown Category: $value"
                                            )
                                    }

                                /**
                                 * Returns this class instance's primitive wire representation.
                                 *
                                 * This differs from the [toString] method because that method is
                                 * primarily for debugging and generally doesn't throw.
                                 *
                                 * @throws IncreaseInvalidDataException if this class instance's
                                 *   value does not have the expected primitive type.
                                 */
                                fun asString(): String =
                                    _value().asString().orElseThrow {
                                        IncreaseInvalidDataException("Value is not a String")
                                    }

                                private var validated: Boolean = false

                                /**
                                 * Validates that the types of all values in this object match their
                                 * expected types recursively.
                                 *
                                 * This method is _not_ forwards compatible with new types from the
                                 * API for existing fields.
                                 *
                                 * @throws IncreaseInvalidDataException if any value type in this
                                 *   object doesn't match its expected type.
                                 */
                                fun validate(): Category = apply {
                                    if (validated) {
                                        return@apply
                                    }

                                    known()
                                    validated = true
                                }

                                fun isValid(): Boolean =
                                    try {
                                        validate()
                                        true
                                    } catch (e: IncreaseInvalidDataException) {
                                        false
                                    }

                                /**
                                 * Returns a score indicating how many valid values are contained in
                                 * this object recursively.
                                 *
                                 * Used for best match union deserialization.
                                 */
                                @JvmSynthetic
                                internal fun validity(): Int =
                                    if (value() == Value._UNKNOWN) 0 else 1

                                override fun equals(other: Any?): Boolean {
                                    if (this === other) {
                                        return true
                                    }

                                    return other is Category && value == other.value
                                }

                                override fun hashCode() = value.hashCode()

                                override fun toString() = value.toString()
                            }

                            override fun equals(other: Any?): Boolean {
                                if (this === other) {
                                    return true
                                }

                                return other is Service &&
                                    category == other.category &&
                                    subCategory == other.subCategory &&
                                    additionalProperties == other.additionalProperties
                            }

                            private val hashCode: Int by lazy {
                                Objects.hash(category, subCategory, additionalProperties)
                            }

                            override fun hashCode(): Int = hashCode

                            override fun toString() =
                                "Service{category=$category, subCategory=$subCategory, additionalProperties=$additionalProperties}"
                        }

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is Ancillary &&
                                connectedTicketDocumentNumber ==
                                    other.connectedTicketDocumentNumber &&
                                creditReasonIndicator == other.creditReasonIndicator &&
                                passengerNameOrDescription == other.passengerNameOrDescription &&
                                services == other.services &&
                                ticketDocumentNumber == other.ticketDocumentNumber &&
                                additionalProperties == other.additionalProperties
                        }

                        private val hashCode: Int by lazy {
                            Objects.hash(
                                connectedTicketDocumentNumber,
                                creditReasonIndicator,
                                passengerNameOrDescription,
                                services,
                                ticketDocumentNumber,
                                additionalProperties,
                            )
                        }

                        override fun hashCode(): Int = hashCode

                        override fun toString() =
                            "Ancillary{connectedTicketDocumentNumber=$connectedTicketDocumentNumber, creditReasonIndicator=$creditReasonIndicator, passengerNameOrDescription=$passengerNameOrDescription, services=$services, ticketDocumentNumber=$ticketDocumentNumber, additionalProperties=$additionalProperties}"
                    }

                    /** Indicates the reason for a credit to the cardholder. */
                    class CreditReasonIndicator
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** No credit */
                            @JvmField val NO_CREDIT = of("no_credit")

                            /** Passenger transport ancillary purchase cancellation */
                            @JvmField
                            val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION =
                                of("passenger_transport_ancillary_purchase_cancellation")

                            /**
                             * Airline ticket and passenger transport ancillary purchase
                             * cancellation
                             */
                            @JvmField
                            val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION =
                                of(
                                    "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation"
                                )

                            /** Airline ticket cancellation */
                            @JvmField
                            val AIRLINE_TICKET_CANCELLATION = of("airline_ticket_cancellation")

                            /** Other */
                            @JvmField val OTHER = of("other")

                            /** Partial refund of airline ticket */
                            @JvmField
                            val PARTIAL_REFUND_OF_AIRLINE_TICKET =
                                of("partial_refund_of_airline_ticket")

                            @JvmStatic
                            fun of(value: String) = CreditReasonIndicator(JsonField.of(value))
                        }

                        /** An enum containing [CreditReasonIndicator]'s known values. */
                        enum class Known {
                            /** No credit */
                            NO_CREDIT,
                            /** Passenger transport ancillary purchase cancellation */
                            PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION,
                            /**
                             * Airline ticket and passenger transport ancillary purchase
                             * cancellation
                             */
                            AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION,
                            /** Airline ticket cancellation */
                            AIRLINE_TICKET_CANCELLATION,
                            /** Other */
                            OTHER,
                            /** Partial refund of airline ticket */
                            PARTIAL_REFUND_OF_AIRLINE_TICKET,
                        }

                        /**
                         * An enum containing [CreditReasonIndicator]'s known values, as well as an
                         * [_UNKNOWN] member.
                         *
                         * An instance of [CreditReasonIndicator] can contain an unknown value in a
                         * couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** No credit */
                            NO_CREDIT,
                            /** Passenger transport ancillary purchase cancellation */
                            PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION,
                            /**
                             * Airline ticket and passenger transport ancillary purchase
                             * cancellation
                             */
                            AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION,
                            /** Airline ticket cancellation */
                            AIRLINE_TICKET_CANCELLATION,
                            /** Other */
                            OTHER,
                            /** Partial refund of airline ticket */
                            PARTIAL_REFUND_OF_AIRLINE_TICKET,
                            /**
                             * An enum member indicating that [CreditReasonIndicator] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NO_CREDIT -> Value.NO_CREDIT
                                PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION ->
                                    Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION
                                AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION ->
                                    Value
                                        .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION
                                AIRLINE_TICKET_CANCELLATION -> Value.AIRLINE_TICKET_CANCELLATION
                                OTHER -> Value.OTHER
                                PARTIAL_REFUND_OF_AIRLINE_TICKET ->
                                    Value.PARTIAL_REFUND_OF_AIRLINE_TICKET
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NO_CREDIT -> Known.NO_CREDIT
                                PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION ->
                                    Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION
                                AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION ->
                                    Known
                                        .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION
                                AIRLINE_TICKET_CANCELLATION -> Known.AIRLINE_TICKET_CANCELLATION
                                OTHER -> Known.OTHER
                                PARTIAL_REFUND_OF_AIRLINE_TICKET ->
                                    Known.PARTIAL_REFUND_OF_AIRLINE_TICKET
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown CreditReasonIndicator: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): CreditReasonIndicator = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is CreditReasonIndicator && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /** Indicates whether this ticket is non-refundable. */
                    class RestrictedTicketIndicator
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** No restrictions */
                            @JvmField val NO_RESTRICTIONS = of("no_restrictions")

                            /** Restricted non-refundable ticket */
                            @JvmField
                            val RESTRICTED_NON_REFUNDABLE_TICKET =
                                of("restricted_non_refundable_ticket")

                            @JvmStatic
                            fun of(value: String) = RestrictedTicketIndicator(JsonField.of(value))
                        }

                        /** An enum containing [RestrictedTicketIndicator]'s known values. */
                        enum class Known {
                            /** No restrictions */
                            NO_RESTRICTIONS,
                            /** Restricted non-refundable ticket */
                            RESTRICTED_NON_REFUNDABLE_TICKET,
                        }

                        /**
                         * An enum containing [RestrictedTicketIndicator]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [RestrictedTicketIndicator] can contain an unknown value
                         * in a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** No restrictions */
                            NO_RESTRICTIONS,
                            /** Restricted non-refundable ticket */
                            RESTRICTED_NON_REFUNDABLE_TICKET,
                            /**
                             * An enum member indicating that [RestrictedTicketIndicator] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NO_RESTRICTIONS -> Value.NO_RESTRICTIONS
                                RESTRICTED_NON_REFUNDABLE_TICKET ->
                                    Value.RESTRICTED_NON_REFUNDABLE_TICKET
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NO_RESTRICTIONS -> Known.NO_RESTRICTIONS
                                RESTRICTED_NON_REFUNDABLE_TICKET ->
                                    Known.RESTRICTED_NON_REFUNDABLE_TICKET
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown RestrictedTicketIndicator: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): RestrictedTicketIndicator = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is RestrictedTicketIndicator && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /** Indicates why a ticket was changed. */
                    class TicketChangeIndicator
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** None */
                            @JvmField val NONE = of("none")

                            /** Change to existing ticket */
                            @JvmField
                            val CHANGE_TO_EXISTING_TICKET = of("change_to_existing_ticket")

                            /** New ticket */
                            @JvmField val NEW_TICKET = of("new_ticket")

                            @JvmStatic
                            fun of(value: String) = TicketChangeIndicator(JsonField.of(value))
                        }

                        /** An enum containing [TicketChangeIndicator]'s known values. */
                        enum class Known {
                            /** None */
                            NONE,
                            /** Change to existing ticket */
                            CHANGE_TO_EXISTING_TICKET,
                            /** New ticket */
                            NEW_TICKET,
                        }

                        /**
                         * An enum containing [TicketChangeIndicator]'s known values, as well as an
                         * [_UNKNOWN] member.
                         *
                         * An instance of [TicketChangeIndicator] can contain an unknown value in a
                         * couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** None */
                            NONE,
                            /** Change to existing ticket */
                            CHANGE_TO_EXISTING_TICKET,
                            /** New ticket */
                            NEW_TICKET,
                            /**
                             * An enum member indicating that [TicketChangeIndicator] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NONE -> Value.NONE
                                CHANGE_TO_EXISTING_TICKET -> Value.CHANGE_TO_EXISTING_TICKET
                                NEW_TICKET -> Value.NEW_TICKET
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NONE -> Known.NONE
                                CHANGE_TO_EXISTING_TICKET -> Known.CHANGE_TO_EXISTING_TICKET
                                NEW_TICKET -> Known.NEW_TICKET
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown TicketChangeIndicator: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): TicketChangeIndicator = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is TicketChangeIndicator && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    class TripLeg
                    @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                    private constructor(
                        private val carrierCode: JsonField<String>,
                        private val destinationCityAirportCode: JsonField<String>,
                        private val fareBasisCode: JsonField<String>,
                        private val flightNumber: JsonField<String>,
                        private val serviceClass: JsonField<String>,
                        private val stopOverCode: JsonField<StopOverCode>,
                        private val additionalProperties: MutableMap<String, JsonValue>,
                    ) {

                        @JsonCreator
                        private constructor(
                            @JsonProperty("carrier_code")
                            @ExcludeMissing
                            carrierCode: JsonField<String> = JsonMissing.of(),
                            @JsonProperty("destination_city_airport_code")
                            @ExcludeMissing
                            destinationCityAirportCode: JsonField<String> = JsonMissing.of(),
                            @JsonProperty("fare_basis_code")
                            @ExcludeMissing
                            fareBasisCode: JsonField<String> = JsonMissing.of(),
                            @JsonProperty("flight_number")
                            @ExcludeMissing
                            flightNumber: JsonField<String> = JsonMissing.of(),
                            @JsonProperty("service_class")
                            @ExcludeMissing
                            serviceClass: JsonField<String> = JsonMissing.of(),
                            @JsonProperty("stop_over_code")
                            @ExcludeMissing
                            stopOverCode: JsonField<StopOverCode> = JsonMissing.of(),
                        ) : this(
                            carrierCode,
                            destinationCityAirportCode,
                            fareBasisCode,
                            flightNumber,
                            serviceClass,
                            stopOverCode,
                            mutableMapOf(),
                        )

                        /**
                         * Carrier code (e.g., United Airlines, Jet Blue, etc.).
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun carrierCode(): Optional<String> =
                            carrierCode.getOptional("carrier_code")

                        /**
                         * Code for the destination city or airport.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun destinationCityAirportCode(): Optional<String> =
                            destinationCityAirportCode.getOptional("destination_city_airport_code")

                        /**
                         * Fare basis code.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun fareBasisCode(): Optional<String> =
                            fareBasisCode.getOptional("fare_basis_code")

                        /**
                         * Flight number.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun flightNumber(): Optional<String> =
                            flightNumber.getOptional("flight_number")

                        /**
                         * Service class (e.g., first class, business class, etc.).
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun serviceClass(): Optional<String> =
                            serviceClass.getOptional("service_class")

                        /**
                         * Indicates whether a stopover is allowed on this ticket.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type (e.g. if the server responded with an unexpected value).
                         */
                        fun stopOverCode(): Optional<StopOverCode> =
                            stopOverCode.getOptional("stop_over_code")

                        /**
                         * Returns the raw JSON value of [carrierCode].
                         *
                         * Unlike [carrierCode], this method doesn't throw if the JSON field has an
                         * unexpected type.
                         */
                        @JsonProperty("carrier_code")
                        @ExcludeMissing
                        fun _carrierCode(): JsonField<String> = carrierCode

                        /**
                         * Returns the raw JSON value of [destinationCityAirportCode].
                         *
                         * Unlike [destinationCityAirportCode], this method doesn't throw if the
                         * JSON field has an unexpected type.
                         */
                        @JsonProperty("destination_city_airport_code")
                        @ExcludeMissing
                        fun _destinationCityAirportCode(): JsonField<String> =
                            destinationCityAirportCode

                        /**
                         * Returns the raw JSON value of [fareBasisCode].
                         *
                         * Unlike [fareBasisCode], this method doesn't throw if the JSON field has
                         * an unexpected type.
                         */
                        @JsonProperty("fare_basis_code")
                        @ExcludeMissing
                        fun _fareBasisCode(): JsonField<String> = fareBasisCode

                        /**
                         * Returns the raw JSON value of [flightNumber].
                         *
                         * Unlike [flightNumber], this method doesn't throw if the JSON field has an
                         * unexpected type.
                         */
                        @JsonProperty("flight_number")
                        @ExcludeMissing
                        fun _flightNumber(): JsonField<String> = flightNumber

                        /**
                         * Returns the raw JSON value of [serviceClass].
                         *
                         * Unlike [serviceClass], this method doesn't throw if the JSON field has an
                         * unexpected type.
                         */
                        @JsonProperty("service_class")
                        @ExcludeMissing
                        fun _serviceClass(): JsonField<String> = serviceClass

                        /**
                         * Returns the raw JSON value of [stopOverCode].
                         *
                         * Unlike [stopOverCode], this method doesn't throw if the JSON field has an
                         * unexpected type.
                         */
                        @JsonProperty("stop_over_code")
                        @ExcludeMissing
                        fun _stopOverCode(): JsonField<StopOverCode> = stopOverCode

                        @JsonAnySetter
                        private fun putAdditionalProperty(key: String, value: JsonValue) {
                            additionalProperties.put(key, value)
                        }

                        @JsonAnyGetter
                        @ExcludeMissing
                        fun _additionalProperties(): Map<String, JsonValue> =
                            Collections.unmodifiableMap(additionalProperties)

                        fun toBuilder() = Builder().from(this)

                        companion object {

                            /**
                             * Returns a mutable builder for constructing an instance of [TripLeg].
                             *
                             * The following fields are required:
                             * ```java
                             * .carrierCode()
                             * .destinationCityAirportCode()
                             * .fareBasisCode()
                             * .flightNumber()
                             * .serviceClass()
                             * .stopOverCode()
                             * ```
                             */
                            @JvmStatic fun builder() = Builder()
                        }

                        /** A builder for [TripLeg]. */
                        class Builder internal constructor() {

                            private var carrierCode: JsonField<String>? = null
                            private var destinationCityAirportCode: JsonField<String>? = null
                            private var fareBasisCode: JsonField<String>? = null
                            private var flightNumber: JsonField<String>? = null
                            private var serviceClass: JsonField<String>? = null
                            private var stopOverCode: JsonField<StopOverCode>? = null
                            private var additionalProperties: MutableMap<String, JsonValue> =
                                mutableMapOf()

                            @JvmSynthetic
                            internal fun from(tripLeg: TripLeg) = apply {
                                carrierCode = tripLeg.carrierCode
                                destinationCityAirportCode = tripLeg.destinationCityAirportCode
                                fareBasisCode = tripLeg.fareBasisCode
                                flightNumber = tripLeg.flightNumber
                                serviceClass = tripLeg.serviceClass
                                stopOverCode = tripLeg.stopOverCode
                                additionalProperties = tripLeg.additionalProperties.toMutableMap()
                            }

                            /** Carrier code (e.g., United Airlines, Jet Blue, etc.). */
                            fun carrierCode(carrierCode: String?) =
                                carrierCode(JsonField.ofNullable(carrierCode))

                            /**
                             * Alias for calling [Builder.carrierCode] with
                             * `carrierCode.orElse(null)`.
                             */
                            fun carrierCode(carrierCode: Optional<String>) =
                                carrierCode(carrierCode.getOrNull())

                            /**
                             * Sets [Builder.carrierCode] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.carrierCode] with a well-typed
                             * [String] value instead. This method is primarily for setting the
                             * field to an undocumented or not yet supported value.
                             */
                            fun carrierCode(carrierCode: JsonField<String>) = apply {
                                this.carrierCode = carrierCode
                            }

                            /** Code for the destination city or airport. */
                            fun destinationCityAirportCode(destinationCityAirportCode: String?) =
                                destinationCityAirportCode(
                                    JsonField.ofNullable(destinationCityAirportCode)
                                )

                            /**
                             * Alias for calling [Builder.destinationCityAirportCode] with
                             * `destinationCityAirportCode.orElse(null)`.
                             */
                            fun destinationCityAirportCode(
                                destinationCityAirportCode: Optional<String>
                            ) = destinationCityAirportCode(destinationCityAirportCode.getOrNull())

                            /**
                             * Sets [Builder.destinationCityAirportCode] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.destinationCityAirportCode] with a
                             * well-typed [String] value instead. This method is primarily for
                             * setting the field to an undocumented or not yet supported value.
                             */
                            fun destinationCityAirportCode(
                                destinationCityAirportCode: JsonField<String>
                            ) = apply {
                                this.destinationCityAirportCode = destinationCityAirportCode
                            }

                            /** Fare basis code. */
                            fun fareBasisCode(fareBasisCode: String?) =
                                fareBasisCode(JsonField.ofNullable(fareBasisCode))

                            /**
                             * Alias for calling [Builder.fareBasisCode] with
                             * `fareBasisCode.orElse(null)`.
                             */
                            fun fareBasisCode(fareBasisCode: Optional<String>) =
                                fareBasisCode(fareBasisCode.getOrNull())

                            /**
                             * Sets [Builder.fareBasisCode] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.fareBasisCode] with a well-typed
                             * [String] value instead. This method is primarily for setting the
                             * field to an undocumented or not yet supported value.
                             */
                            fun fareBasisCode(fareBasisCode: JsonField<String>) = apply {
                                this.fareBasisCode = fareBasisCode
                            }

                            /** Flight number. */
                            fun flightNumber(flightNumber: String?) =
                                flightNumber(JsonField.ofNullable(flightNumber))

                            /**
                             * Alias for calling [Builder.flightNumber] with
                             * `flightNumber.orElse(null)`.
                             */
                            fun flightNumber(flightNumber: Optional<String>) =
                                flightNumber(flightNumber.getOrNull())

                            /**
                             * Sets [Builder.flightNumber] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.flightNumber] with a well-typed
                             * [String] value instead. This method is primarily for setting the
                             * field to an undocumented or not yet supported value.
                             */
                            fun flightNumber(flightNumber: JsonField<String>) = apply {
                                this.flightNumber = flightNumber
                            }

                            /** Service class (e.g., first class, business class, etc.). */
                            fun serviceClass(serviceClass: String?) =
                                serviceClass(JsonField.ofNullable(serviceClass))

                            /**
                             * Alias for calling [Builder.serviceClass] with
                             * `serviceClass.orElse(null)`.
                             */
                            fun serviceClass(serviceClass: Optional<String>) =
                                serviceClass(serviceClass.getOrNull())

                            /**
                             * Sets [Builder.serviceClass] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.serviceClass] with a well-typed
                             * [String] value instead. This method is primarily for setting the
                             * field to an undocumented or not yet supported value.
                             */
                            fun serviceClass(serviceClass: JsonField<String>) = apply {
                                this.serviceClass = serviceClass
                            }

                            /** Indicates whether a stopover is allowed on this ticket. */
                            fun stopOverCode(stopOverCode: StopOverCode?) =
                                stopOverCode(JsonField.ofNullable(stopOverCode))

                            /**
                             * Alias for calling [Builder.stopOverCode] with
                             * `stopOverCode.orElse(null)`.
                             */
                            fun stopOverCode(stopOverCode: Optional<StopOverCode>) =
                                stopOverCode(stopOverCode.getOrNull())

                            /**
                             * Sets [Builder.stopOverCode] to an arbitrary JSON value.
                             *
                             * You should usually call [Builder.stopOverCode] with a well-typed
                             * [StopOverCode] value instead. This method is primarily for setting
                             * the field to an undocumented or not yet supported value.
                             */
                            fun stopOverCode(stopOverCode: JsonField<StopOverCode>) = apply {
                                this.stopOverCode = stopOverCode
                            }

                            fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                                apply {
                                    this.additionalProperties.clear()
                                    putAllAdditionalProperties(additionalProperties)
                                }

                            fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                                additionalProperties.put(key, value)
                            }

                            fun putAllAdditionalProperties(
                                additionalProperties: Map<String, JsonValue>
                            ) = apply { this.additionalProperties.putAll(additionalProperties) }

                            fun removeAdditionalProperty(key: String) = apply {
                                additionalProperties.remove(key)
                            }

                            fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                                keys.forEach(::removeAdditionalProperty)
                            }

                            /**
                             * Returns an immutable instance of [TripLeg].
                             *
                             * Further updates to this [Builder] will not mutate the returned
                             * instance.
                             *
                             * The following fields are required:
                             * ```java
                             * .carrierCode()
                             * .destinationCityAirportCode()
                             * .fareBasisCode()
                             * .flightNumber()
                             * .serviceClass()
                             * .stopOverCode()
                             * ```
                             *
                             * @throws IllegalStateException if any required field is unset.
                             */
                            fun build(): TripLeg =
                                TripLeg(
                                    checkRequired("carrierCode", carrierCode),
                                    checkRequired(
                                        "destinationCityAirportCode",
                                        destinationCityAirportCode,
                                    ),
                                    checkRequired("fareBasisCode", fareBasisCode),
                                    checkRequired("flightNumber", flightNumber),
                                    checkRequired("serviceClass", serviceClass),
                                    checkRequired("stopOverCode", stopOverCode),
                                    additionalProperties.toMutableMap(),
                                )
                        }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): TripLeg = apply {
                            if (validated) {
                                return@apply
                            }

                            carrierCode()
                            destinationCityAirportCode()
                            fareBasisCode()
                            flightNumber()
                            serviceClass()
                            stopOverCode().ifPresent { it.validate() }
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int =
                            (if (carrierCode.asKnown().isPresent) 1 else 0) +
                                (if (destinationCityAirportCode.asKnown().isPresent) 1 else 0) +
                                (if (fareBasisCode.asKnown().isPresent) 1 else 0) +
                                (if (flightNumber.asKnown().isPresent) 1 else 0) +
                                (if (serviceClass.asKnown().isPresent) 1 else 0) +
                                (stopOverCode.asKnown().getOrNull()?.validity() ?: 0)

                        /** Indicates whether a stopover is allowed on this ticket. */
                        class StopOverCode
                        @JsonCreator
                        private constructor(private val value: JsonField<String>) : Enum {

                            /**
                             * Returns this class instance's raw value.
                             *
                             * This is usually only useful if this instance was deserialized from
                             * data that doesn't match any known member, and you want to know that
                             * value. For example, if the SDK is on an older version than the API,
                             * then the API may respond with new members that the SDK is unaware of.
                             */
                            @com.fasterxml.jackson.annotation.JsonValue
                            fun _value(): JsonField<String> = value

                            companion object {

                                /** None */
                                @JvmField val NONE = of("none")

                                /** Stop over allowed */
                                @JvmField val STOP_OVER_ALLOWED = of("stop_over_allowed")

                                /** Stop over not allowed */
                                @JvmField val STOP_OVER_NOT_ALLOWED = of("stop_over_not_allowed")

                                @JvmStatic fun of(value: String) = StopOverCode(JsonField.of(value))
                            }

                            /** An enum containing [StopOverCode]'s known values. */
                            enum class Known {
                                /** None */
                                NONE,
                                /** Stop over allowed */
                                STOP_OVER_ALLOWED,
                                /** Stop over not allowed */
                                STOP_OVER_NOT_ALLOWED,
                            }

                            /**
                             * An enum containing [StopOverCode]'s known values, as well as an
                             * [_UNKNOWN] member.
                             *
                             * An instance of [StopOverCode] can contain an unknown value in a
                             * couple of cases:
                             * - It was deserialized from data that doesn't match any known member.
                             *   For example, if the SDK is on an older version than the API, then
                             *   the API may respond with new members that the SDK is unaware of.
                             * - It was constructed with an arbitrary value using the [of] method.
                             */
                            enum class Value {
                                /** None */
                                NONE,
                                /** Stop over allowed */
                                STOP_OVER_ALLOWED,
                                /** Stop over not allowed */
                                STOP_OVER_NOT_ALLOWED,
                                /**
                                 * An enum member indicating that [StopOverCode] was instantiated
                                 * with an unknown value.
                                 */
                                _UNKNOWN,
                            }

                            /**
                             * Returns an enum member corresponding to this class instance's value,
                             * or [Value._UNKNOWN] if the class was instantiated with an unknown
                             * value.
                             *
                             * Use the [known] method instead if you're certain the value is always
                             * known or if you want to throw for the unknown case.
                             */
                            fun value(): Value =
                                when (this) {
                                    NONE -> Value.NONE
                                    STOP_OVER_ALLOWED -> Value.STOP_OVER_ALLOWED
                                    STOP_OVER_NOT_ALLOWED -> Value.STOP_OVER_NOT_ALLOWED
                                    else -> Value._UNKNOWN
                                }

                            /**
                             * Returns an enum member corresponding to this class instance's value.
                             *
                             * Use the [value] method instead if you're uncertain the value is
                             * always known and don't want to throw for the unknown case.
                             *
                             * @throws IncreaseInvalidDataException if this class instance's value
                             *   is a not a known member.
                             */
                            fun known(): Known =
                                when (this) {
                                    NONE -> Known.NONE
                                    STOP_OVER_ALLOWED -> Known.STOP_OVER_ALLOWED
                                    STOP_OVER_NOT_ALLOWED -> Known.STOP_OVER_NOT_ALLOWED
                                    else ->
                                        throw IncreaseInvalidDataException(
                                            "Unknown StopOverCode: $value"
                                        )
                                }

                            /**
                             * Returns this class instance's primitive wire representation.
                             *
                             * This differs from the [toString] method because that method is
                             * primarily for debugging and generally doesn't throw.
                             *
                             * @throws IncreaseInvalidDataException if this class instance's value
                             *   does not have the expected primitive type.
                             */
                            fun asString(): String =
                                _value().asString().orElseThrow {
                                    IncreaseInvalidDataException("Value is not a String")
                                }

                            private var validated: Boolean = false

                            /**
                             * Validates that the types of all values in this object match their
                             * expected types recursively.
                             *
                             * This method is _not_ forwards compatible with new types from the API
                             * for existing fields.
                             *
                             * @throws IncreaseInvalidDataException if any value type in this object
                             *   doesn't match its expected type.
                             */
                            fun validate(): StopOverCode = apply {
                                if (validated) {
                                    return@apply
                                }

                                known()
                                validated = true
                            }

                            fun isValid(): Boolean =
                                try {
                                    validate()
                                    true
                                } catch (e: IncreaseInvalidDataException) {
                                    false
                                }

                            /**
                             * Returns a score indicating how many valid values are contained in
                             * this object recursively.
                             *
                             * Used for best match union deserialization.
                             */
                            @JvmSynthetic
                            internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                            override fun equals(other: Any?): Boolean {
                                if (this === other) {
                                    return true
                                }

                                return other is StopOverCode && value == other.value
                            }

                            override fun hashCode() = value.hashCode()

                            override fun toString() = value.toString()
                        }

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is TripLeg &&
                                carrierCode == other.carrierCode &&
                                destinationCityAirportCode == other.destinationCityAirportCode &&
                                fareBasisCode == other.fareBasisCode &&
                                flightNumber == other.flightNumber &&
                                serviceClass == other.serviceClass &&
                                stopOverCode == other.stopOverCode &&
                                additionalProperties == other.additionalProperties
                        }

                        private val hashCode: Int by lazy {
                            Objects.hash(
                                carrierCode,
                                destinationCityAirportCode,
                                fareBasisCode,
                                flightNumber,
                                serviceClass,
                                stopOverCode,
                                additionalProperties,
                            )
                        }

                        override fun hashCode(): Int = hashCode

                        override fun toString() =
                            "TripLeg{carrierCode=$carrierCode, destinationCityAirportCode=$destinationCityAirportCode, fareBasisCode=$fareBasisCode, flightNumber=$flightNumber, serviceClass=$serviceClass, stopOverCode=$stopOverCode, additionalProperties=$additionalProperties}"
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Travel &&
                            ancillary == other.ancillary &&
                            computerizedReservationSystem == other.computerizedReservationSystem &&
                            creditReasonIndicator == other.creditReasonIndicator &&
                            departureDate == other.departureDate &&
                            originationCityAirportCode == other.originationCityAirportCode &&
                            passengerName == other.passengerName &&
                            restrictedTicketIndicator == other.restrictedTicketIndicator &&
                            ticketChangeIndicator == other.ticketChangeIndicator &&
                            ticketNumber == other.ticketNumber &&
                            travelAgencyCode == other.travelAgencyCode &&
                            travelAgencyName == other.travelAgencyName &&
                            tripLegs == other.tripLegs &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            ancillary,
                            computerizedReservationSystem,
                            creditReasonIndicator,
                            departureDate,
                            originationCityAirportCode,
                            passengerName,
                            restrictedTicketIndicator,
                            ticketChangeIndicator,
                            ticketNumber,
                            travelAgencyCode,
                            travelAgencyName,
                            tripLegs,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Travel{ancillary=$ancillary, computerizedReservationSystem=$computerizedReservationSystem, creditReasonIndicator=$creditReasonIndicator, departureDate=$departureDate, originationCityAirportCode=$originationCityAirportCode, passengerName=$passengerName, restrictedTicketIndicator=$restrictedTicketIndicator, ticketChangeIndicator=$ticketChangeIndicator, ticketNumber=$ticketNumber, travelAgencyCode=$travelAgencyCode, travelAgencyName=$travelAgencyName, tripLegs=$tripLegs, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is PurchaseDetails &&
                        carRental == other.carRental &&
                        customerReferenceIdentifier == other.customerReferenceIdentifier &&
                        localTaxAmount == other.localTaxAmount &&
                        localTaxCurrency == other.localTaxCurrency &&
                        lodging == other.lodging &&
                        nationalTaxAmount == other.nationalTaxAmount &&
                        nationalTaxCurrency == other.nationalTaxCurrency &&
                        purchaseIdentifier == other.purchaseIdentifier &&
                        purchaseIdentifierFormat == other.purchaseIdentifierFormat &&
                        travel == other.travel &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        carRental,
                        customerReferenceIdentifier,
                        localTaxAmount,
                        localTaxCurrency,
                        lodging,
                        nationalTaxAmount,
                        nationalTaxCurrency,
                        purchaseIdentifier,
                        purchaseIdentifierFormat,
                        travel,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "PurchaseDetails{carRental=$carRental, customerReferenceIdentifier=$customerReferenceIdentifier, localTaxAmount=$localTaxAmount, localTaxCurrency=$localTaxCurrency, lodging=$lodging, nationalTaxAmount=$nationalTaxAmount, nationalTaxCurrency=$nationalTaxCurrency, purchaseIdentifier=$purchaseIdentifier, purchaseIdentifierFormat=$purchaseIdentifierFormat, travel=$travel, additionalProperties=$additionalProperties}"
            }

            class SchemeFee
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val amount: JsonField<String>,
                private val createdAt: JsonField<OffsetDateTime>,
                private val currency: JsonField<Currency>,
                private val feeType: JsonField<FeeType>,
                private val fixedComponent: JsonField<String>,
                private val variableRate: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("amount")
                    @ExcludeMissing
                    amount: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("created_at")
                    @ExcludeMissing
                    createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                    @JsonProperty("currency")
                    @ExcludeMissing
                    currency: JsonField<Currency> = JsonMissing.of(),
                    @JsonProperty("fee_type")
                    @ExcludeMissing
                    feeType: JsonField<FeeType> = JsonMissing.of(),
                    @JsonProperty("fixed_component")
                    @ExcludeMissing
                    fixedComponent: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("variable_rate")
                    @ExcludeMissing
                    variableRate: JsonField<String> = JsonMissing.of(),
                ) : this(
                    amount,
                    createdAt,
                    currency,
                    feeType,
                    fixedComponent,
                    variableRate,
                    mutableMapOf(),
                )

                /**
                 * The fee amount given as a string containing a decimal number.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun amount(): String = amount.getRequired("amount")

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was
                 * created.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /**
                 * The type of fee being assessed.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun feeType(): FeeType = feeType.getRequired("fee_type")

                /**
                 * The fixed component of the fee, if applicable, given in major units of the fee
                 * amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun fixedComponent(): Optional<String> =
                    fixedComponent.getOptional("fixed_component")

                /**
                 * The variable rate component of the fee, if applicable, given as a decimal (e.g.,
                 * 0.015 for 1.5%).
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun variableRate(): Optional<String> = variableRate.getOptional("variable_rate")

                /**
                 * Returns the raw JSON value of [amount].
                 *
                 * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<String> = amount

                /**
                 * Returns the raw JSON value of [createdAt].
                 *
                 * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("created_at")
                @ExcludeMissing
                fun _createdAt(): JsonField<OffsetDateTime> = createdAt

                /**
                 * Returns the raw JSON value of [currency].
                 *
                 * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun _currency(): JsonField<Currency> = currency

                /**
                 * Returns the raw JSON value of [feeType].
                 *
                 * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("fee_type")
                @ExcludeMissing
                fun _feeType(): JsonField<FeeType> = feeType

                /**
                 * Returns the raw JSON value of [fixedComponent].
                 *
                 * Unlike [fixedComponent], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("fixed_component")
                @ExcludeMissing
                fun _fixedComponent(): JsonField<String> = fixedComponent

                /**
                 * Returns the raw JSON value of [variableRate].
                 *
                 * Unlike [variableRate], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("variable_rate")
                @ExcludeMissing
                fun _variableRate(): JsonField<String> = variableRate

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [SchemeFee].
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [SchemeFee]. */
                class Builder internal constructor() {

                    private var amount: JsonField<String>? = null
                    private var createdAt: JsonField<OffsetDateTime>? = null
                    private var currency: JsonField<Currency>? = null
                    private var feeType: JsonField<FeeType>? = null
                    private var fixedComponent: JsonField<String>? = null
                    private var variableRate: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(schemeFee: SchemeFee) = apply {
                        amount = schemeFee.amount
                        createdAt = schemeFee.createdAt
                        currency = schemeFee.currency
                        feeType = schemeFee.feeType
                        fixedComponent = schemeFee.fixedComponent
                        variableRate = schemeFee.variableRate
                        additionalProperties = schemeFee.additionalProperties.toMutableMap()
                    }

                    /** The fee amount given as a string containing a decimal number. */
                    fun amount(amount: String) = amount(JsonField.of(amount))

                    /**
                     * Sets [Builder.amount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.amount] with a well-typed [String] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun amount(amount: JsonField<String>) = apply { this.amount = amount }

                    /**
                     * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee
                     * was created.
                     */
                    fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt))

                    /**
                     * Sets [Builder.createdAt] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.createdAt] with a well-typed
                     * [OffsetDateTime] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply {
                        this.createdAt = createdAt
                    }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                     * reimbursement.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * Sets [Builder.currency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.currency] with a well-typed [Currency] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                    /** The type of fee being assessed. */
                    fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType))

                    /**
                     * Sets [Builder.feeType] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.feeType] with a well-typed [FeeType] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun feeType(feeType: JsonField<FeeType>) = apply { this.feeType = feeType }

                    /**
                     * The fixed component of the fee, if applicable, given in major units of the
                     * fee amount.
                     */
                    fun fixedComponent(fixedComponent: String?) =
                        fixedComponent(JsonField.ofNullable(fixedComponent))

                    /**
                     * Alias for calling [Builder.fixedComponent] with
                     * `fixedComponent.orElse(null)`.
                     */
                    fun fixedComponent(fixedComponent: Optional<String>) =
                        fixedComponent(fixedComponent.getOrNull())

                    /**
                     * Sets [Builder.fixedComponent] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.fixedComponent] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun fixedComponent(fixedComponent: JsonField<String>) = apply {
                        this.fixedComponent = fixedComponent
                    }

                    /**
                     * The variable rate component of the fee, if applicable, given as a decimal
                     * (e.g., 0.015 for 1.5%).
                     */
                    fun variableRate(variableRate: String?) =
                        variableRate(JsonField.ofNullable(variableRate))

                    /**
                     * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`.
                     */
                    fun variableRate(variableRate: Optional<String>) =
                        variableRate(variableRate.getOrNull())

                    /**
                     * Sets [Builder.variableRate] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.variableRate] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun variableRate(variableRate: JsonField<String>) = apply {
                        this.variableRate = variableRate
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [SchemeFee].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): SchemeFee =
                        SchemeFee(
                            checkRequired("amount", amount),
                            checkRequired("createdAt", createdAt),
                            checkRequired("currency", currency),
                            checkRequired("feeType", feeType),
                            checkRequired("fixedComponent", fixedComponent),
                            checkRequired("variableRate", variableRate),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): SchemeFee = apply {
                    if (validated) {
                        return@apply
                    }

                    amount()
                    createdAt()
                    currency().validate()
                    feeType().validate()
                    fixedComponent()
                    variableRate()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (amount.asKnown().isPresent) 1 else 0) +
                        (if (createdAt.asKnown().isPresent) 1 else 0) +
                        (currency.asKnown().getOrNull()?.validity() ?: 0) +
                        (feeType.asKnown().getOrNull()?.validity() ?: 0) +
                        (if (fixedComponent.asKnown().isPresent) 1 else 0) +
                        (if (variableRate.asKnown().isPresent) 1 else 0)

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 */
                class Currency
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** US Dollar (USD) */
                        @JvmField val USD = of("USD")

                        @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                    }

                    /** An enum containing [Currency]'s known values. */
                    enum class Known {
                        /** US Dollar (USD) */
                        USD
                    }

                    /**
                     * An enum containing [Currency]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Currency] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** US Dollar (USD) */
                        USD,
                        /**
                         * An enum member indicating that [Currency] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            USD -> Value.USD
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            USD -> Known.USD
                            else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Currency = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Currency && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** The type of fee being assessed. */
                class FeeType
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY =
                            of("visa_international_service_assessment_single_currency")

                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY =
                            of("visa_international_service_assessment_cross_currency")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE =
                            of("visa_authorization_domestic_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_international_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE =
                            of("visa_authorization_canada_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_international_point_of_sale")

                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE =
                            of("visa_authorization_address_verification_service")

                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        @JvmField
                        val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization")

                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission")

                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_DOMESTIC =
                            of("visa_account_verification_domestic")

                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL =
                            of("visa_account_verification_international")

                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_CANADA =
                            of("visa_account_verification_canada")

                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee")

                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        @JvmField
                        val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE =
                            of("visa_consumer_debit_acceptance_fee")

                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        @JvmField
                        val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE =
                            of("visa_business_debit_acceptance_fee")

                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee")

                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic")

                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        @JvmField
                        val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international")

                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token")

                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token")

                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission")

                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization")

                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        @JvmField
                        val VISA_DIRECT_TRANSACTION_DOMESTIC =
                            of("visa_direct_transaction_domestic")

                        /** Issuer card service fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit")

                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT =
                            of("visa_advertising_service_commercial_credit")

                        /** Issuer Community Growth Acceleration Program Fee. */
                        @JvmField
                        val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM =
                            of("visa_community_growth_acceleration_program")

                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        @JvmField
                        val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT =
                            of("visa_processing_guarantee_commercial_credit")

                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee")

                        @JvmStatic fun of(value: String) = FeeType(JsonField.of(value))
                    }

                    /** An enum containing [FeeType]'s known values. */
                    enum class Known {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                    }

                    /**
                     * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member.
                     *
                     * An instance of [FeeType] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                        /**
                         * An enum member indicating that [FeeType] was instantiated with an unknown
                         * value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Value.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Value.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Known.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Known.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE
                            else -> throw IncreaseInvalidDataException("Unknown FeeType: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): FeeType = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is FeeType && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is SchemeFee &&
                        amount == other.amount &&
                        createdAt == other.createdAt &&
                        currency == other.currency &&
                        feeType == other.feeType &&
                        fixedComponent == other.fixedComponent &&
                        variableRate == other.variableRate &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        amount,
                        createdAt,
                        currency,
                        feeType,
                        fixedComponent,
                        variableRate,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}"
            }

            /**
             * Surcharge amount details, if applicable. The amount is positive if the surcharge is
             * added to the overall transaction amount (surcharge), and negative if the surcharge is
             * deducted from the overall transaction amount (discount).
             */
            class Surcharge
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val amount: JsonField<Long>,
                private val presentmentAmount: JsonField<Long>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("amount")
                    @ExcludeMissing
                    amount: JsonField<Long> = JsonMissing.of(),
                    @JsonProperty("presentment_amount")
                    @ExcludeMissing
                    presentmentAmount: JsonField<Long> = JsonMissing.of(),
                ) : this(amount, presentmentAmount, mutableMapOf())

                /**
                 * The surcharge amount in the minor unit of the transaction's settlement currency.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun amount(): Long = amount.getRequired("amount")

                /**
                 * The surcharge amount in the minor unit of the transaction's presentment currency.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun presentmentAmount(): Long = presentmentAmount.getRequired("presentment_amount")

                /**
                 * Returns the raw JSON value of [amount].
                 *
                 * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                /**
                 * Returns the raw JSON value of [presentmentAmount].
                 *
                 * Unlike [presentmentAmount], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("presentment_amount")
                @ExcludeMissing
                fun _presentmentAmount(): JsonField<Long> = presentmentAmount

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [Surcharge].
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .presentmentAmount()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [Surcharge]. */
                class Builder internal constructor() {

                    private var amount: JsonField<Long>? = null
                    private var presentmentAmount: JsonField<Long>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(surcharge: Surcharge) = apply {
                        amount = surcharge.amount
                        presentmentAmount = surcharge.presentmentAmount
                        additionalProperties = surcharge.additionalProperties.toMutableMap()
                    }

                    /**
                     * The surcharge amount in the minor unit of the transaction's settlement
                     * currency.
                     */
                    fun amount(amount: Long) = amount(JsonField.of(amount))

                    /**
                     * Sets [Builder.amount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.amount] with a well-typed [Long] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                    /**
                     * The surcharge amount in the minor unit of the transaction's presentment
                     * currency.
                     */
                    fun presentmentAmount(presentmentAmount: Long) =
                        presentmentAmount(JsonField.of(presentmentAmount))

                    /**
                     * Sets [Builder.presentmentAmount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.presentmentAmount] with a well-typed [Long]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun presentmentAmount(presentmentAmount: JsonField<Long>) = apply {
                        this.presentmentAmount = presentmentAmount
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [Surcharge].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .presentmentAmount()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): Surcharge =
                        Surcharge(
                            checkRequired("amount", amount),
                            checkRequired("presentmentAmount", presentmentAmount),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Surcharge = apply {
                    if (validated) {
                        return@apply
                    }

                    amount()
                    presentmentAmount()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (amount.asKnown().isPresent) 1 else 0) +
                        (if (presentmentAmount.asKnown().isPresent) 1 else 0)

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Surcharge &&
                        amount == other.amount &&
                        presentmentAmount == other.presentmentAmount &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(amount, presentmentAmount, additionalProperties)
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "Surcharge{amount=$amount, presentmentAmount=$presentmentAmount, additionalProperties=$additionalProperties}"
            }

            /**
             * A constant representing the object's type. For this resource it will always be
             * `card_settlement`.
             */
            class Type @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    @JvmField val CARD_SETTLEMENT = of("card_settlement")

                    @JvmStatic fun of(value: String) = Type(JsonField.of(value))
                }

                /** An enum containing [Type]'s known values. */
                enum class Known {
                    CARD_SETTLEMENT
                }

                /**
                 * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Type] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    CARD_SETTLEMENT,
                    /**
                     * An enum member indicating that [Type] was instantiated with an unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        CARD_SETTLEMENT -> Value.CARD_SETTLEMENT
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        CARD_SETTLEMENT -> Known.CARD_SETTLEMENT
                        else -> throw IncreaseInvalidDataException("Unknown Type: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Type = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Type && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            override fun equals(other: Any?): Boolean {
                if (this === other) {
                    return true
                }

                return other is CardSettlement &&
                    id == other.id &&
                    amount == other.amount &&
                    cardAuthorization == other.cardAuthorization &&
                    cardPaymentId == other.cardPaymentId &&
                    cashback == other.cashback &&
                    currency == other.currency &&
                    interchange == other.interchange &&
                    merchantAcceptorId == other.merchantAcceptorId &&
                    merchantCategoryCode == other.merchantCategoryCode &&
                    merchantCity == other.merchantCity &&
                    merchantCountry == other.merchantCountry &&
                    merchantName == other.merchantName &&
                    merchantPostalCode == other.merchantPostalCode &&
                    merchantState == other.merchantState &&
                    network == other.network &&
                    networkIdentifiers == other.networkIdentifiers &&
                    pendingTransactionId == other.pendingTransactionId &&
                    presentmentAmount == other.presentmentAmount &&
                    presentmentCurrency == other.presentmentCurrency &&
                    purchaseDetails == other.purchaseDetails &&
                    schemeFees == other.schemeFees &&
                    surcharge == other.surcharge &&
                    transactionId == other.transactionId &&
                    type == other.type &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    id,
                    amount,
                    cardAuthorization,
                    cardPaymentId,
                    cashback,
                    currency,
                    interchange,
                    merchantAcceptorId,
                    merchantCategoryCode,
                    merchantCity,
                    merchantCountry,
                    merchantName,
                    merchantPostalCode,
                    merchantState,
                    network,
                    networkIdentifiers,
                    pendingTransactionId,
                    presentmentAmount,
                    presentmentCurrency,
                    purchaseDetails,
                    schemeFees,
                    surcharge,
                    transactionId,
                    type,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardSettlement{id=$id, amount=$amount, cardAuthorization=$cardAuthorization, cardPaymentId=$cardPaymentId, cashback=$cashback, currency=$currency, interchange=$interchange, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantName=$merchantName, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, network=$network, networkIdentifiers=$networkIdentifiers, pendingTransactionId=$pendingTransactionId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, purchaseDetails=$purchaseDetails, schemeFees=$schemeFees, surcharge=$surcharge, transactionId=$transactionId, type=$type, additionalProperties=$additionalProperties}"
        }

        /**
         * An Inbound Card Validation object. This field will be present in the JSON response if and
         * only if `category` is equal to `card_validation`. Inbound Card Validations are requests
         * from a merchant to verify that a card number and optionally its address and/or Card
         * Verification Value are valid.
         */
        class CardValidation
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val id: JsonField<String>,
            private val actioner: JsonField<Actioner>,
            private val additionalAmounts: JsonField<AdditionalAmounts>,
            private val cardPaymentId: JsonField<String>,
            private val currency: JsonField<Currency>,
            private val digitalWalletTokenId: JsonField<String>,
            private val merchantAcceptorId: JsonField<String>,
            private val merchantCategoryCode: JsonField<String>,
            private val merchantCity: JsonField<String>,
            private val merchantCountry: JsonField<String>,
            private val merchantDescriptor: JsonField<String>,
            private val merchantPostalCode: JsonField<String>,
            private val merchantState: JsonField<String>,
            private val networkDetails: JsonField<NetworkDetails>,
            private val networkIdentifiers: JsonField<NetworkIdentifiers>,
            private val networkRiskScore: JsonField<Long>,
            private val physicalCardId: JsonField<String>,
            private val realTimeDecisionId: JsonField<String>,
            private val schemeFees: JsonField<List<SchemeFee>>,
            private val terminalId: JsonField<String>,
            private val type: JsonField<Type>,
            private val verification: JsonField<Verification>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
                @JsonProperty("actioner")
                @ExcludeMissing
                actioner: JsonField<Actioner> = JsonMissing.of(),
                @JsonProperty("additional_amounts")
                @ExcludeMissing
                additionalAmounts: JsonField<AdditionalAmounts> = JsonMissing.of(),
                @JsonProperty("card_payment_id")
                @ExcludeMissing
                cardPaymentId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("digital_wallet_token_id")
                @ExcludeMissing
                digitalWalletTokenId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_acceptor_id")
                @ExcludeMissing
                merchantAcceptorId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_category_code")
                @ExcludeMissing
                merchantCategoryCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_city")
                @ExcludeMissing
                merchantCity: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_country")
                @ExcludeMissing
                merchantCountry: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_descriptor")
                @ExcludeMissing
                merchantDescriptor: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_postal_code")
                @ExcludeMissing
                merchantPostalCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("merchant_state")
                @ExcludeMissing
                merchantState: JsonField<String> = JsonMissing.of(),
                @JsonProperty("network_details")
                @ExcludeMissing
                networkDetails: JsonField<NetworkDetails> = JsonMissing.of(),
                @JsonProperty("network_identifiers")
                @ExcludeMissing
                networkIdentifiers: JsonField<NetworkIdentifiers> = JsonMissing.of(),
                @JsonProperty("network_risk_score")
                @ExcludeMissing
                networkRiskScore: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("physical_card_id")
                @ExcludeMissing
                physicalCardId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("real_time_decision_id")
                @ExcludeMissing
                realTimeDecisionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("scheme_fees")
                @ExcludeMissing
                schemeFees: JsonField<List<SchemeFee>> = JsonMissing.of(),
                @JsonProperty("terminal_id")
                @ExcludeMissing
                terminalId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
                @JsonProperty("verification")
                @ExcludeMissing
                verification: JsonField<Verification> = JsonMissing.of(),
            ) : this(
                id,
                actioner,
                additionalAmounts,
                cardPaymentId,
                currency,
                digitalWalletTokenId,
                merchantAcceptorId,
                merchantCategoryCode,
                merchantCity,
                merchantCountry,
                merchantDescriptor,
                merchantPostalCode,
                merchantState,
                networkDetails,
                networkIdentifiers,
                networkRiskScore,
                physicalCardId,
                realTimeDecisionId,
                schemeFees,
                terminalId,
                type,
                verification,
                mutableMapOf(),
            )

            /**
             * The Card Validation identifier.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun id(): String = id.getRequired("id")

            /**
             * Whether this authorization was approved by Increase, the card network through
             * stand-in processing, or the user through a real-time decision.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun actioner(): Actioner = actioner.getRequired("actioner")

            /**
             * Additional amounts associated with the card authorization, such as ATM surcharges
             * fees. These are usually a subset of the `amount` field and are used to provide more
             * detailed information about the transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun additionalAmounts(): AdditionalAmounts =
                additionalAmounts.getRequired("additional_amounts")

            /**
             * The ID of the Card Payment this transaction belongs to.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun cardPaymentId(): String = cardPaymentId.getRequired("card_payment_id")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
             * currency.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun currency(): Currency = currency.getRequired("currency")

            /**
             * If the authorization was made via a Digital Wallet Token (such as an Apple Pay
             * purchase), the identifier of the token that was used.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun digitalWalletTokenId(): Optional<String> =
                digitalWalletTokenId.getOptional("digital_wallet_token_id")

            /**
             * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantAcceptorId(): String =
                merchantAcceptorId.getRequired("merchant_acceptor_id")

            /**
             * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCategoryCode(): String =
                merchantCategoryCode.getRequired("merchant_category_code")

            /**
             * The city the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantCity(): Optional<String> = merchantCity.getOptional("merchant_city")

            /**
             * The country the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantCountry(): String = merchantCountry.getRequired("merchant_country")

            /**
             * The merchant descriptor of the merchant the card is transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun merchantDescriptor(): String = merchantDescriptor.getRequired("merchant_descriptor")

            /**
             * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit ZIP
             * code, where the first 5 and last 4 are separated by a dash.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantPostalCode(): Optional<String> =
                merchantPostalCode.getOptional("merchant_postal_code")

            /**
             * The state the merchant resides in.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun merchantState(): Optional<String> = merchantState.getOptional("merchant_state")

            /**
             * Fields specific to the `network`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details")

            /**
             * Network-specific identifiers for a specific request or transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun networkIdentifiers(): NetworkIdentifiers =
                networkIdentifiers.getRequired("network_identifiers")

            /**
             * The risk score generated by the card network. For Visa this is the Visa Advanced
             * Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the score
             * is from 0 to 999, where 999 is the riskiest.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun networkRiskScore(): Optional<Long> =
                networkRiskScore.getOptional("network_risk_score")

            /**
             * If the authorization was made in-person with a physical card, the Physical Card that
             * was used.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun physicalCardId(): Optional<String> = physicalCardId.getOptional("physical_card_id")

            /**
             * The identifier of the Real-Time Decision sent to approve or decline this transaction.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun realTimeDecisionId(): Optional<String> =
                realTimeDecisionId.getOptional("real_time_decision_id")

            /**
             * The scheme fees associated with this card validation.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun schemeFees(): List<SchemeFee> = schemeFees.getRequired("scheme_fees")

            /**
             * The terminal identifier (commonly abbreviated as TID) of the terminal the card is
             * transacting with.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun terminalId(): Optional<String> = terminalId.getOptional("terminal_id")

            /**
             * A constant representing the object's type. For this resource it will always be
             * `inbound_card_validation`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun type(): Type = type.getRequired("type")

            /**
             * Fields related to verification of cardholder-provided values.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun verification(): Verification = verification.getRequired("verification")

            /**
             * Returns the raw JSON value of [id].
             *
             * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id

            /**
             * Returns the raw JSON value of [actioner].
             *
             * Unlike [actioner], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("actioner")
            @ExcludeMissing
            fun _actioner(): JsonField<Actioner> = actioner

            /**
             * Returns the raw JSON value of [additionalAmounts].
             *
             * Unlike [additionalAmounts], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("additional_amounts")
            @ExcludeMissing
            fun _additionalAmounts(): JsonField<AdditionalAmounts> = additionalAmounts

            /**
             * Returns the raw JSON value of [cardPaymentId].
             *
             * Unlike [cardPaymentId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("card_payment_id")
            @ExcludeMissing
            fun _cardPaymentId(): JsonField<String> = cardPaymentId

            /**
             * Returns the raw JSON value of [currency].
             *
             * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("currency")
            @ExcludeMissing
            fun _currency(): JsonField<Currency> = currency

            /**
             * Returns the raw JSON value of [digitalWalletTokenId].
             *
             * Unlike [digitalWalletTokenId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("digital_wallet_token_id")
            @ExcludeMissing
            fun _digitalWalletTokenId(): JsonField<String> = digitalWalletTokenId

            /**
             * Returns the raw JSON value of [merchantAcceptorId].
             *
             * Unlike [merchantAcceptorId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_acceptor_id")
            @ExcludeMissing
            fun _merchantAcceptorId(): JsonField<String> = merchantAcceptorId

            /**
             * Returns the raw JSON value of [merchantCategoryCode].
             *
             * Unlike [merchantCategoryCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_category_code")
            @ExcludeMissing
            fun _merchantCategoryCode(): JsonField<String> = merchantCategoryCode

            /**
             * Returns the raw JSON value of [merchantCity].
             *
             * Unlike [merchantCity], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_city")
            @ExcludeMissing
            fun _merchantCity(): JsonField<String> = merchantCity

            /**
             * Returns the raw JSON value of [merchantCountry].
             *
             * Unlike [merchantCountry], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_country")
            @ExcludeMissing
            fun _merchantCountry(): JsonField<String> = merchantCountry

            /**
             * Returns the raw JSON value of [merchantDescriptor].
             *
             * Unlike [merchantDescriptor], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_descriptor")
            @ExcludeMissing
            fun _merchantDescriptor(): JsonField<String> = merchantDescriptor

            /**
             * Returns the raw JSON value of [merchantPostalCode].
             *
             * Unlike [merchantPostalCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("merchant_postal_code")
            @ExcludeMissing
            fun _merchantPostalCode(): JsonField<String> = merchantPostalCode

            /**
             * Returns the raw JSON value of [merchantState].
             *
             * Unlike [merchantState], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("merchant_state")
            @ExcludeMissing
            fun _merchantState(): JsonField<String> = merchantState

            /**
             * Returns the raw JSON value of [networkDetails].
             *
             * Unlike [networkDetails], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_details")
            @ExcludeMissing
            fun _networkDetails(): JsonField<NetworkDetails> = networkDetails

            /**
             * Returns the raw JSON value of [networkIdentifiers].
             *
             * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_identifiers")
            @ExcludeMissing
            fun _networkIdentifiers(): JsonField<NetworkIdentifiers> = networkIdentifiers

            /**
             * Returns the raw JSON value of [networkRiskScore].
             *
             * Unlike [networkRiskScore], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("network_risk_score")
            @ExcludeMissing
            fun _networkRiskScore(): JsonField<Long> = networkRiskScore

            /**
             * Returns the raw JSON value of [physicalCardId].
             *
             * Unlike [physicalCardId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("physical_card_id")
            @ExcludeMissing
            fun _physicalCardId(): JsonField<String> = physicalCardId

            /**
             * Returns the raw JSON value of [realTimeDecisionId].
             *
             * Unlike [realTimeDecisionId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("real_time_decision_id")
            @ExcludeMissing
            fun _realTimeDecisionId(): JsonField<String> = realTimeDecisionId

            /**
             * Returns the raw JSON value of [schemeFees].
             *
             * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("scheme_fees")
            @ExcludeMissing
            fun _schemeFees(): JsonField<List<SchemeFee>> = schemeFees

            /**
             * Returns the raw JSON value of [terminalId].
             *
             * Unlike [terminalId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("terminal_id")
            @ExcludeMissing
            fun _terminalId(): JsonField<String> = terminalId

            /**
             * Returns the raw JSON value of [type].
             *
             * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("type") @ExcludeMissing fun _type(): JsonField<Type> = type

            /**
             * Returns the raw JSON value of [verification].
             *
             * Unlike [verification], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("verification")
            @ExcludeMissing
            fun _verification(): JsonField<Verification> = verification

            @JsonAnySetter
            private fun putAdditionalProperty(key: String, value: JsonValue) {
                additionalProperties.put(key, value)
            }

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map<String, JsonValue> =
                Collections.unmodifiableMap(additionalProperties)

            fun toBuilder() = Builder().from(this)

            companion object {

                /**
                 * Returns a mutable builder for constructing an instance of [CardValidation].
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .actioner()
                 * .additionalAmounts()
                 * .cardPaymentId()
                 * .currency()
                 * .digitalWalletTokenId()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCity()
                 * .merchantCountry()
                 * .merchantDescriptor()
                 * .merchantPostalCode()
                 * .merchantState()
                 * .networkDetails()
                 * .networkIdentifiers()
                 * .networkRiskScore()
                 * .physicalCardId()
                 * .realTimeDecisionId()
                 * .schemeFees()
                 * .terminalId()
                 * .type()
                 * .verification()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

            /** A builder for [CardValidation]. */
            class Builder internal constructor() {

                private var id: JsonField<String>? = null
                private var actioner: JsonField<Actioner>? = null
                private var additionalAmounts: JsonField<AdditionalAmounts>? = null
                private var cardPaymentId: JsonField<String>? = null
                private var currency: JsonField<Currency>? = null
                private var digitalWalletTokenId: JsonField<String>? = null
                private var merchantAcceptorId: JsonField<String>? = null
                private var merchantCategoryCode: JsonField<String>? = null
                private var merchantCity: JsonField<String>? = null
                private var merchantCountry: JsonField<String>? = null
                private var merchantDescriptor: JsonField<String>? = null
                private var merchantPostalCode: JsonField<String>? = null
                private var merchantState: JsonField<String>? = null
                private var networkDetails: JsonField<NetworkDetails>? = null
                private var networkIdentifiers: JsonField<NetworkIdentifiers>? = null
                private var networkRiskScore: JsonField<Long>? = null
                private var physicalCardId: JsonField<String>? = null
                private var realTimeDecisionId: JsonField<String>? = null
                private var schemeFees: JsonField<MutableList<SchemeFee>>? = null
                private var terminalId: JsonField<String>? = null
                private var type: JsonField<Type>? = null
                private var verification: JsonField<Verification>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardValidation: CardValidation) = apply {
                    id = cardValidation.id
                    actioner = cardValidation.actioner
                    additionalAmounts = cardValidation.additionalAmounts
                    cardPaymentId = cardValidation.cardPaymentId
                    currency = cardValidation.currency
                    digitalWalletTokenId = cardValidation.digitalWalletTokenId
                    merchantAcceptorId = cardValidation.merchantAcceptorId
                    merchantCategoryCode = cardValidation.merchantCategoryCode
                    merchantCity = cardValidation.merchantCity
                    merchantCountry = cardValidation.merchantCountry
                    merchantDescriptor = cardValidation.merchantDescriptor
                    merchantPostalCode = cardValidation.merchantPostalCode
                    merchantState = cardValidation.merchantState
                    networkDetails = cardValidation.networkDetails
                    networkIdentifiers = cardValidation.networkIdentifiers
                    networkRiskScore = cardValidation.networkRiskScore
                    physicalCardId = cardValidation.physicalCardId
                    realTimeDecisionId = cardValidation.realTimeDecisionId
                    schemeFees = cardValidation.schemeFees.map { it.toMutableList() }
                    terminalId = cardValidation.terminalId
                    type = cardValidation.type
                    verification = cardValidation.verification
                    additionalProperties = cardValidation.additionalProperties.toMutableMap()
                }

                /** The Card Validation identifier. */
                fun id(id: String) = id(JsonField.of(id))

                /**
                 * Sets [Builder.id] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.id] with a well-typed [String] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun id(id: JsonField<String>) = apply { this.id = id }

                /**
                 * Whether this authorization was approved by Increase, the card network through
                 * stand-in processing, or the user through a real-time decision.
                 */
                fun actioner(actioner: Actioner) = actioner(JsonField.of(actioner))

                /**
                 * Sets [Builder.actioner] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.actioner] with a well-typed [Actioner] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun actioner(actioner: JsonField<Actioner>) = apply { this.actioner = actioner }

                /**
                 * Additional amounts associated with the card authorization, such as ATM surcharges
                 * fees. These are usually a subset of the `amount` field and are used to provide
                 * more detailed information about the transaction.
                 */
                fun additionalAmounts(additionalAmounts: AdditionalAmounts) =
                    additionalAmounts(JsonField.of(additionalAmounts))

                /**
                 * Sets [Builder.additionalAmounts] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.additionalAmounts] with a well-typed
                 * [AdditionalAmounts] value instead. This method is primarily for setting the field
                 * to an undocumented or not yet supported value.
                 */
                fun additionalAmounts(additionalAmounts: JsonField<AdditionalAmounts>) = apply {
                    this.additionalAmounts = additionalAmounts
                }

                /** The ID of the Card Payment this transaction belongs to. */
                fun cardPaymentId(cardPaymentId: String) =
                    cardPaymentId(JsonField.of(cardPaymentId))

                /**
                 * Sets [Builder.cardPaymentId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.cardPaymentId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun cardPaymentId(cardPaymentId: JsonField<String>) = apply {
                    this.cardPaymentId = cardPaymentId
                }

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
                 * currency.
                 */
                fun currency(currency: Currency) = currency(JsonField.of(currency))

                /**
                 * Sets [Builder.currency] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.currency] with a well-typed [Currency] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                /**
                 * If the authorization was made via a Digital Wallet Token (such as an Apple Pay
                 * purchase), the identifier of the token that was used.
                 */
                fun digitalWalletTokenId(digitalWalletTokenId: String?) =
                    digitalWalletTokenId(JsonField.ofNullable(digitalWalletTokenId))

                /**
                 * Alias for calling [Builder.digitalWalletTokenId] with
                 * `digitalWalletTokenId.orElse(null)`.
                 */
                fun digitalWalletTokenId(digitalWalletTokenId: Optional<String>) =
                    digitalWalletTokenId(digitalWalletTokenId.getOrNull())

                /**
                 * Sets [Builder.digitalWalletTokenId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.digitalWalletTokenId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun digitalWalletTokenId(digitalWalletTokenId: JsonField<String>) = apply {
                    this.digitalWalletTokenId = digitalWalletTokenId
                }

                /**
                 * The merchant identifier (commonly abbreviated as MID) of the merchant the card is
                 * transacting with.
                 */
                fun merchantAcceptorId(merchantAcceptorId: String) =
                    merchantAcceptorId(JsonField.of(merchantAcceptorId))

                /**
                 * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantAcceptorId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantAcceptorId(merchantAcceptorId: JsonField<String>) = apply {
                    this.merchantAcceptorId = merchantAcceptorId
                }

                /**
                 * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card
                 * is transacting with.
                 */
                fun merchantCategoryCode(merchantCategoryCode: String) =
                    merchantCategoryCode(JsonField.of(merchantCategoryCode))

                /**
                 * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCategoryCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCategoryCode(merchantCategoryCode: JsonField<String>) = apply {
                    this.merchantCategoryCode = merchantCategoryCode
                }

                /** The city the merchant resides in. */
                fun merchantCity(merchantCity: String?) =
                    merchantCity(JsonField.ofNullable(merchantCity))

                /** Alias for calling [Builder.merchantCity] with `merchantCity.orElse(null)`. */
                fun merchantCity(merchantCity: Optional<String>) =
                    merchantCity(merchantCity.getOrNull())

                /**
                 * Sets [Builder.merchantCity] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCity] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantCity(merchantCity: JsonField<String>) = apply {
                    this.merchantCity = merchantCity
                }

                /** The country the merchant resides in. */
                fun merchantCountry(merchantCountry: String) =
                    merchantCountry(JsonField.of(merchantCountry))

                /**
                 * Sets [Builder.merchantCountry] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantCountry] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantCountry(merchantCountry: JsonField<String>) = apply {
                    this.merchantCountry = merchantCountry
                }

                /** The merchant descriptor of the merchant the card is transacting with. */
                fun merchantDescriptor(merchantDescriptor: String) =
                    merchantDescriptor(JsonField.of(merchantDescriptor))

                /**
                 * Sets [Builder.merchantDescriptor] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantDescriptor] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantDescriptor(merchantDescriptor: JsonField<String>) = apply {
                    this.merchantDescriptor = merchantDescriptor
                }

                /**
                 * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit
                 * ZIP code, where the first 5 and last 4 are separated by a dash.
                 */
                fun merchantPostalCode(merchantPostalCode: String?) =
                    merchantPostalCode(JsonField.ofNullable(merchantPostalCode))

                /**
                 * Alias for calling [Builder.merchantPostalCode] with
                 * `merchantPostalCode.orElse(null)`.
                 */
                fun merchantPostalCode(merchantPostalCode: Optional<String>) =
                    merchantPostalCode(merchantPostalCode.getOrNull())

                /**
                 * Sets [Builder.merchantPostalCode] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantPostalCode] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun merchantPostalCode(merchantPostalCode: JsonField<String>) = apply {
                    this.merchantPostalCode = merchantPostalCode
                }

                /** The state the merchant resides in. */
                fun merchantState(merchantState: String?) =
                    merchantState(JsonField.ofNullable(merchantState))

                /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */
                fun merchantState(merchantState: Optional<String>) =
                    merchantState(merchantState.getOrNull())

                /**
                 * Sets [Builder.merchantState] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.merchantState] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun merchantState(merchantState: JsonField<String>) = apply {
                    this.merchantState = merchantState
                }

                /** Fields specific to the `network`. */
                fun networkDetails(networkDetails: NetworkDetails) =
                    networkDetails(JsonField.of(networkDetails))

                /**
                 * Sets [Builder.networkDetails] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkDetails] with a well-typed
                 * [NetworkDetails] value instead. This method is primarily for setting the field to
                 * an undocumented or not yet supported value.
                 */
                fun networkDetails(networkDetails: JsonField<NetworkDetails>) = apply {
                    this.networkDetails = networkDetails
                }

                /** Network-specific identifiers for a specific request or transaction. */
                fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) =
                    networkIdentifiers(JsonField.of(networkIdentifiers))

                /**
                 * Sets [Builder.networkIdentifiers] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkIdentifiers] with a well-typed
                 * [NetworkIdentifiers] value instead. This method is primarily for setting the
                 * field to an undocumented or not yet supported value.
                 */
                fun networkIdentifiers(networkIdentifiers: JsonField<NetworkIdentifiers>) = apply {
                    this.networkIdentifiers = networkIdentifiers
                }

                /**
                 * The risk score generated by the card network. For Visa this is the Visa Advanced
                 * Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the
                 * score is from 0 to 999, where 999 is the riskiest.
                 */
                fun networkRiskScore(networkRiskScore: Long?) =
                    networkRiskScore(JsonField.ofNullable(networkRiskScore))

                /**
                 * Alias for [Builder.networkRiskScore].
                 *
                 * This unboxed primitive overload exists for backwards compatibility.
                 */
                fun networkRiskScore(networkRiskScore: Long) =
                    networkRiskScore(networkRiskScore as Long?)

                /**
                 * Alias for calling [Builder.networkRiskScore] with
                 * `networkRiskScore.orElse(null)`.
                 */
                fun networkRiskScore(networkRiskScore: Optional<Long>) =
                    networkRiskScore(networkRiskScore.getOrNull())

                /**
                 * Sets [Builder.networkRiskScore] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.networkRiskScore] with a well-typed [Long] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun networkRiskScore(networkRiskScore: JsonField<Long>) = apply {
                    this.networkRiskScore = networkRiskScore
                }

                /**
                 * If the authorization was made in-person with a physical card, the Physical Card
                 * that was used.
                 */
                fun physicalCardId(physicalCardId: String?) =
                    physicalCardId(JsonField.ofNullable(physicalCardId))

                /**
                 * Alias for calling [Builder.physicalCardId] with `physicalCardId.orElse(null)`.
                 */
                fun physicalCardId(physicalCardId: Optional<String>) =
                    physicalCardId(physicalCardId.getOrNull())

                /**
                 * Sets [Builder.physicalCardId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.physicalCardId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun physicalCardId(physicalCardId: JsonField<String>) = apply {
                    this.physicalCardId = physicalCardId
                }

                /**
                 * The identifier of the Real-Time Decision sent to approve or decline this
                 * transaction.
                 */
                fun realTimeDecisionId(realTimeDecisionId: String?) =
                    realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId))

                /**
                 * Alias for calling [Builder.realTimeDecisionId] with
                 * `realTimeDecisionId.orElse(null)`.
                 */
                fun realTimeDecisionId(realTimeDecisionId: Optional<String>) =
                    realTimeDecisionId(realTimeDecisionId.getOrNull())

                /**
                 * Sets [Builder.realTimeDecisionId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.realTimeDecisionId] with a well-typed [String]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun realTimeDecisionId(realTimeDecisionId: JsonField<String>) = apply {
                    this.realTimeDecisionId = realTimeDecisionId
                }

                /** The scheme fees associated with this card validation. */
                fun schemeFees(schemeFees: List<SchemeFee>) = schemeFees(JsonField.of(schemeFees))

                /**
                 * Sets [Builder.schemeFees] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.schemeFees] with a well-typed `List<SchemeFee>`
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun schemeFees(schemeFees: JsonField<List<SchemeFee>>) = apply {
                    this.schemeFees = schemeFees.map { it.toMutableList() }
                }

                /**
                 * Adds a single [SchemeFee] to [schemeFees].
                 *
                 * @throws IllegalStateException if the field was previously set to a non-list.
                 */
                fun addSchemeFee(schemeFee: SchemeFee) = apply {
                    schemeFees =
                        (schemeFees ?: JsonField.of(mutableListOf())).also {
                            checkKnown("schemeFees", it).add(schemeFee)
                        }
                }

                /**
                 * The terminal identifier (commonly abbreviated as TID) of the terminal the card is
                 * transacting with.
                 */
                fun terminalId(terminalId: String?) = terminalId(JsonField.ofNullable(terminalId))

                /** Alias for calling [Builder.terminalId] with `terminalId.orElse(null)`. */
                fun terminalId(terminalId: Optional<String>) = terminalId(terminalId.getOrNull())

                /**
                 * Sets [Builder.terminalId] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.terminalId] with a well-typed [String] value
                 * instead. This method is primarily for setting the field to an undocumented or not
                 * yet supported value.
                 */
                fun terminalId(terminalId: JsonField<String>) = apply {
                    this.terminalId = terminalId
                }

                /**
                 * A constant representing the object's type. For this resource it will always be
                 * `inbound_card_validation`.
                 */
                fun type(type: Type) = type(JsonField.of(type))

                /**
                 * Sets [Builder.type] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.type] with a well-typed [Type] value instead.
                 * This method is primarily for setting the field to an undocumented or not yet
                 * supported value.
                 */
                fun type(type: JsonField<Type>) = apply { this.type = type }

                /** Fields related to verification of cardholder-provided values. */
                fun verification(verification: Verification) =
                    verification(JsonField.of(verification))

                /**
                 * Sets [Builder.verification] to an arbitrary JSON value.
                 *
                 * You should usually call [Builder.verification] with a well-typed [Verification]
                 * value instead. This method is primarily for setting the field to an undocumented
                 * or not yet supported value.
                 */
                fun verification(verification: JsonField<Verification>) = apply {
                    this.verification = verification
                }

                fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                    this.additionalProperties.clear()
                    putAllAdditionalProperties(additionalProperties)
                }

                fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                    additionalProperties.put(key, value)
                }

                fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun removeAdditionalProperty(key: String) = apply {
                    additionalProperties.remove(key)
                }

                fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                    keys.forEach(::removeAdditionalProperty)
                }

                /**
                 * Returns an immutable instance of [CardValidation].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .id()
                 * .actioner()
                 * .additionalAmounts()
                 * .cardPaymentId()
                 * .currency()
                 * .digitalWalletTokenId()
                 * .merchantAcceptorId()
                 * .merchantCategoryCode()
                 * .merchantCity()
                 * .merchantCountry()
                 * .merchantDescriptor()
                 * .merchantPostalCode()
                 * .merchantState()
                 * .networkDetails()
                 * .networkIdentifiers()
                 * .networkRiskScore()
                 * .physicalCardId()
                 * .realTimeDecisionId()
                 * .schemeFees()
                 * .terminalId()
                 * .type()
                 * .verification()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardValidation =
                    CardValidation(
                        checkRequired("id", id),
                        checkRequired("actioner", actioner),
                        checkRequired("additionalAmounts", additionalAmounts),
                        checkRequired("cardPaymentId", cardPaymentId),
                        checkRequired("currency", currency),
                        checkRequired("digitalWalletTokenId", digitalWalletTokenId),
                        checkRequired("merchantAcceptorId", merchantAcceptorId),
                        checkRequired("merchantCategoryCode", merchantCategoryCode),
                        checkRequired("merchantCity", merchantCity),
                        checkRequired("merchantCountry", merchantCountry),
                        checkRequired("merchantDescriptor", merchantDescriptor),
                        checkRequired("merchantPostalCode", merchantPostalCode),
                        checkRequired("merchantState", merchantState),
                        checkRequired("networkDetails", networkDetails),
                        checkRequired("networkIdentifiers", networkIdentifiers),
                        checkRequired("networkRiskScore", networkRiskScore),
                        checkRequired("physicalCardId", physicalCardId),
                        checkRequired("realTimeDecisionId", realTimeDecisionId),
                        checkRequired("schemeFees", schemeFees).map { it.toImmutable() },
                        checkRequired("terminalId", terminalId),
                        checkRequired("type", type),
                        checkRequired("verification", verification),
                        additionalProperties.toMutableMap(),
                    )
            }

            private var validated: Boolean = false

            /**
             * Validates that the types of all values in this object match their expected types
             * recursively.
             *
             * This method is _not_ forwards compatible with new types from the API for existing
             * fields.
             *
             * @throws IncreaseInvalidDataException if any value type in this object doesn't match
             *   its expected type.
             */
            fun validate(): CardValidation = apply {
                if (validated) {
                    return@apply
                }

                id()
                actioner().validate()
                additionalAmounts().validate()
                cardPaymentId()
                currency().validate()
                digitalWalletTokenId()
                merchantAcceptorId()
                merchantCategoryCode()
                merchantCity()
                merchantCountry()
                merchantDescriptor()
                merchantPostalCode()
                merchantState()
                networkDetails().validate()
                networkIdentifiers().validate()
                networkRiskScore()
                physicalCardId()
                realTimeDecisionId()
                schemeFees().forEach { it.validate() }
                terminalId()
                type().validate()
                verification().validate()
                validated = true
            }

            fun isValid(): Boolean =
                try {
                    validate()
                    true
                } catch (e: IncreaseInvalidDataException) {
                    false
                }

            /**
             * Returns a score indicating how many valid values are contained in this object
             * recursively.
             *
             * Used for best match union deserialization.
             */
            @JvmSynthetic
            internal fun validity(): Int =
                (if (id.asKnown().isPresent) 1 else 0) +
                    (actioner.asKnown().getOrNull()?.validity() ?: 0) +
                    (additionalAmounts.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (cardPaymentId.asKnown().isPresent) 1 else 0) +
                    (currency.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (digitalWalletTokenId.asKnown().isPresent) 1 else 0) +
                    (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) +
                    (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantCity.asKnown().isPresent) 1 else 0) +
                    (if (merchantCountry.asKnown().isPresent) 1 else 0) +
                    (if (merchantDescriptor.asKnown().isPresent) 1 else 0) +
                    (if (merchantPostalCode.asKnown().isPresent) 1 else 0) +
                    (if (merchantState.asKnown().isPresent) 1 else 0) +
                    (networkDetails.asKnown().getOrNull()?.validity() ?: 0) +
                    (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (networkRiskScore.asKnown().isPresent) 1 else 0) +
                    (if (physicalCardId.asKnown().isPresent) 1 else 0) +
                    (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) +
                    (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
                    (if (terminalId.asKnown().isPresent) 1 else 0) +
                    (type.asKnown().getOrNull()?.validity() ?: 0) +
                    (verification.asKnown().getOrNull()?.validity() ?: 0)

            /**
             * Whether this authorization was approved by Increase, the card network through
             * stand-in processing, or the user through a real-time decision.
             */
            class Actioner @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** This object was actioned by the user through a real-time decision. */
                    @JvmField val USER = of("user")

                    /** This object was actioned by Increase without user intervention. */
                    @JvmField val INCREASE = of("increase")

                    /** This object was actioned by the network, through stand-in processing. */
                    @JvmField val NETWORK = of("network")

                    @JvmStatic fun of(value: String) = Actioner(JsonField.of(value))
                }

                /** An enum containing [Actioner]'s known values. */
                enum class Known {
                    /** This object was actioned by the user through a real-time decision. */
                    USER,
                    /** This object was actioned by Increase without user intervention. */
                    INCREASE,
                    /** This object was actioned by the network, through stand-in processing. */
                    NETWORK,
                }

                /**
                 * An enum containing [Actioner]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Actioner] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** This object was actioned by the user through a real-time decision. */
                    USER,
                    /** This object was actioned by Increase without user intervention. */
                    INCREASE,
                    /** This object was actioned by the network, through stand-in processing. */
                    NETWORK,
                    /**
                     * An enum member indicating that [Actioner] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        USER -> Value.USER
                        INCREASE -> Value.INCREASE
                        NETWORK -> Value.NETWORK
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        USER -> Known.USER
                        INCREASE -> Known.INCREASE
                        NETWORK -> Known.NETWORK
                        else -> throw IncreaseInvalidDataException("Unknown Actioner: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Actioner = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Actioner && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /**
             * Additional amounts associated with the card authorization, such as ATM surcharges
             * fees. These are usually a subset of the `amount` field and are used to provide more
             * detailed information about the transaction.
             */
            class AdditionalAmounts
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val clinic: JsonField<Clinic>,
                private val dental: JsonField<Dental>,
                private val original: JsonField<Original>,
                private val prescription: JsonField<Prescription>,
                private val surcharge: JsonField<Surcharge>,
                private val totalCumulative: JsonField<TotalCumulative>,
                private val totalHealthcare: JsonField<TotalHealthcare>,
                private val transit: JsonField<Transit>,
                private val unknown: JsonField<Unknown>,
                private val vision: JsonField<Vision>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("clinic")
                    @ExcludeMissing
                    clinic: JsonField<Clinic> = JsonMissing.of(),
                    @JsonProperty("dental")
                    @ExcludeMissing
                    dental: JsonField<Dental> = JsonMissing.of(),
                    @JsonProperty("original")
                    @ExcludeMissing
                    original: JsonField<Original> = JsonMissing.of(),
                    @JsonProperty("prescription")
                    @ExcludeMissing
                    prescription: JsonField<Prescription> = JsonMissing.of(),
                    @JsonProperty("surcharge")
                    @ExcludeMissing
                    surcharge: JsonField<Surcharge> = JsonMissing.of(),
                    @JsonProperty("total_cumulative")
                    @ExcludeMissing
                    totalCumulative: JsonField<TotalCumulative> = JsonMissing.of(),
                    @JsonProperty("total_healthcare")
                    @ExcludeMissing
                    totalHealthcare: JsonField<TotalHealthcare> = JsonMissing.of(),
                    @JsonProperty("transit")
                    @ExcludeMissing
                    transit: JsonField<Transit> = JsonMissing.of(),
                    @JsonProperty("unknown")
                    @ExcludeMissing
                    unknown: JsonField<Unknown> = JsonMissing.of(),
                    @JsonProperty("vision")
                    @ExcludeMissing
                    vision: JsonField<Vision> = JsonMissing.of(),
                ) : this(
                    clinic,
                    dental,
                    original,
                    prescription,
                    surcharge,
                    totalCumulative,
                    totalHealthcare,
                    transit,
                    unknown,
                    vision,
                    mutableMapOf(),
                )

                /**
                 * The part of this transaction amount that was for clinic-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun clinic(): Optional<Clinic> = clinic.getOptional("clinic")

                /**
                 * The part of this transaction amount that was for dental-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun dental(): Optional<Dental> = dental.getOptional("dental")

                /**
                 * The original pre-authorized amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun original(): Optional<Original> = original.getOptional("original")

                /**
                 * The part of this transaction amount that was for healthcare prescriptions.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun prescription(): Optional<Prescription> =
                    prescription.getOptional("prescription")

                /**
                 * The surcharge amount charged for this transaction by the merchant.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun surcharge(): Optional<Surcharge> = surcharge.getOptional("surcharge")

                /**
                 * The total amount of a series of incremental authorizations, optionally provided.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun totalCumulative(): Optional<TotalCumulative> =
                    totalCumulative.getOptional("total_cumulative")

                /**
                 * The total amount of healthcare-related additional amounts.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun totalHealthcare(): Optional<TotalHealthcare> =
                    totalHealthcare.getOptional("total_healthcare")

                /**
                 * The part of this transaction amount that was for transit-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun transit(): Optional<Transit> = transit.getOptional("transit")

                /**
                 * An unknown additional amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun unknown(): Optional<Unknown> = unknown.getOptional("unknown")

                /**
                 * The part of this transaction amount that was for vision-related services.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun vision(): Optional<Vision> = vision.getOptional("vision")

                /**
                 * Returns the raw JSON value of [clinic].
                 *
                 * Unlike [clinic], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("clinic") @ExcludeMissing fun _clinic(): JsonField<Clinic> = clinic

                /**
                 * Returns the raw JSON value of [dental].
                 *
                 * Unlike [dental], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("dental") @ExcludeMissing fun _dental(): JsonField<Dental> = dental

                /**
                 * Returns the raw JSON value of [original].
                 *
                 * Unlike [original], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("original")
                @ExcludeMissing
                fun _original(): JsonField<Original> = original

                /**
                 * Returns the raw JSON value of [prescription].
                 *
                 * Unlike [prescription], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("prescription")
                @ExcludeMissing
                fun _prescription(): JsonField<Prescription> = prescription

                /**
                 * Returns the raw JSON value of [surcharge].
                 *
                 * Unlike [surcharge], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("surcharge")
                @ExcludeMissing
                fun _surcharge(): JsonField<Surcharge> = surcharge

                /**
                 * Returns the raw JSON value of [totalCumulative].
                 *
                 * Unlike [totalCumulative], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("total_cumulative")
                @ExcludeMissing
                fun _totalCumulative(): JsonField<TotalCumulative> = totalCumulative

                /**
                 * Returns the raw JSON value of [totalHealthcare].
                 *
                 * Unlike [totalHealthcare], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("total_healthcare")
                @ExcludeMissing
                fun _totalHealthcare(): JsonField<TotalHealthcare> = totalHealthcare

                /**
                 * Returns the raw JSON value of [transit].
                 *
                 * Unlike [transit], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("transit")
                @ExcludeMissing
                fun _transit(): JsonField<Transit> = transit

                /**
                 * Returns the raw JSON value of [unknown].
                 *
                 * Unlike [unknown], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("unknown")
                @ExcludeMissing
                fun _unknown(): JsonField<Unknown> = unknown

                /**
                 * Returns the raw JSON value of [vision].
                 *
                 * Unlike [vision], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("vision") @ExcludeMissing fun _vision(): JsonField<Vision> = vision

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of
                     * [AdditionalAmounts].
                     *
                     * The following fields are required:
                     * ```java
                     * .clinic()
                     * .dental()
                     * .original()
                     * .prescription()
                     * .surcharge()
                     * .totalCumulative()
                     * .totalHealthcare()
                     * .transit()
                     * .unknown()
                     * .vision()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [AdditionalAmounts]. */
                class Builder internal constructor() {

                    private var clinic: JsonField<Clinic>? = null
                    private var dental: JsonField<Dental>? = null
                    private var original: JsonField<Original>? = null
                    private var prescription: JsonField<Prescription>? = null
                    private var surcharge: JsonField<Surcharge>? = null
                    private var totalCumulative: JsonField<TotalCumulative>? = null
                    private var totalHealthcare: JsonField<TotalHealthcare>? = null
                    private var transit: JsonField<Transit>? = null
                    private var unknown: JsonField<Unknown>? = null
                    private var vision: JsonField<Vision>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(additionalAmounts: AdditionalAmounts) = apply {
                        clinic = additionalAmounts.clinic
                        dental = additionalAmounts.dental
                        original = additionalAmounts.original
                        prescription = additionalAmounts.prescription
                        surcharge = additionalAmounts.surcharge
                        totalCumulative = additionalAmounts.totalCumulative
                        totalHealthcare = additionalAmounts.totalHealthcare
                        transit = additionalAmounts.transit
                        unknown = additionalAmounts.unknown
                        vision = additionalAmounts.vision
                        additionalProperties = additionalAmounts.additionalProperties.toMutableMap()
                    }

                    /** The part of this transaction amount that was for clinic-related services. */
                    fun clinic(clinic: Clinic?) = clinic(JsonField.ofNullable(clinic))

                    /** Alias for calling [Builder.clinic] with `clinic.orElse(null)`. */
                    fun clinic(clinic: Optional<Clinic>) = clinic(clinic.getOrNull())

                    /**
                     * Sets [Builder.clinic] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.clinic] with a well-typed [Clinic] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun clinic(clinic: JsonField<Clinic>) = apply { this.clinic = clinic }

                    /** The part of this transaction amount that was for dental-related services. */
                    fun dental(dental: Dental?) = dental(JsonField.ofNullable(dental))

                    /** Alias for calling [Builder.dental] with `dental.orElse(null)`. */
                    fun dental(dental: Optional<Dental>) = dental(dental.getOrNull())

                    /**
                     * Sets [Builder.dental] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.dental] with a well-typed [Dental] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun dental(dental: JsonField<Dental>) = apply { this.dental = dental }

                    /** The original pre-authorized amount. */
                    fun original(original: Original?) = original(JsonField.ofNullable(original))

                    /** Alias for calling [Builder.original] with `original.orElse(null)`. */
                    fun original(original: Optional<Original>) = original(original.getOrNull())

                    /**
                     * Sets [Builder.original] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.original] with a well-typed [Original] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun original(original: JsonField<Original>) = apply { this.original = original }

                    /**
                     * The part of this transaction amount that was for healthcare prescriptions.
                     */
                    fun prescription(prescription: Prescription?) =
                        prescription(JsonField.ofNullable(prescription))

                    /**
                     * Alias for calling [Builder.prescription] with `prescription.orElse(null)`.
                     */
                    fun prescription(prescription: Optional<Prescription>) =
                        prescription(prescription.getOrNull())

                    /**
                     * Sets [Builder.prescription] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.prescription] with a well-typed
                     * [Prescription] value instead. This method is primarily for setting the field
                     * to an undocumented or not yet supported value.
                     */
                    fun prescription(prescription: JsonField<Prescription>) = apply {
                        this.prescription = prescription
                    }

                    /** The surcharge amount charged for this transaction by the merchant. */
                    fun surcharge(surcharge: Surcharge?) =
                        surcharge(JsonField.ofNullable(surcharge))

                    /** Alias for calling [Builder.surcharge] with `surcharge.orElse(null)`. */
                    fun surcharge(surcharge: Optional<Surcharge>) = surcharge(surcharge.getOrNull())

                    /**
                     * Sets [Builder.surcharge] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.surcharge] with a well-typed [Surcharge]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun surcharge(surcharge: JsonField<Surcharge>) = apply {
                        this.surcharge = surcharge
                    }

                    /**
                     * The total amount of a series of incremental authorizations, optionally
                     * provided.
                     */
                    fun totalCumulative(totalCumulative: TotalCumulative?) =
                        totalCumulative(JsonField.ofNullable(totalCumulative))

                    /**
                     * Alias for calling [Builder.totalCumulative] with
                     * `totalCumulative.orElse(null)`.
                     */
                    fun totalCumulative(totalCumulative: Optional<TotalCumulative>) =
                        totalCumulative(totalCumulative.getOrNull())

                    /**
                     * Sets [Builder.totalCumulative] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.totalCumulative] with a well-typed
                     * [TotalCumulative] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun totalCumulative(totalCumulative: JsonField<TotalCumulative>) = apply {
                        this.totalCumulative = totalCumulative
                    }

                    /** The total amount of healthcare-related additional amounts. */
                    fun totalHealthcare(totalHealthcare: TotalHealthcare?) =
                        totalHealthcare(JsonField.ofNullable(totalHealthcare))

                    /**
                     * Alias for calling [Builder.totalHealthcare] with
                     * `totalHealthcare.orElse(null)`.
                     */
                    fun totalHealthcare(totalHealthcare: Optional<TotalHealthcare>) =
                        totalHealthcare(totalHealthcare.getOrNull())

                    /**
                     * Sets [Builder.totalHealthcare] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.totalHealthcare] with a well-typed
                     * [TotalHealthcare] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun totalHealthcare(totalHealthcare: JsonField<TotalHealthcare>) = apply {
                        this.totalHealthcare = totalHealthcare
                    }

                    /**
                     * The part of this transaction amount that was for transit-related services.
                     */
                    fun transit(transit: Transit?) = transit(JsonField.ofNullable(transit))

                    /** Alias for calling [Builder.transit] with `transit.orElse(null)`. */
                    fun transit(transit: Optional<Transit>) = transit(transit.getOrNull())

                    /**
                     * Sets [Builder.transit] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.transit] with a well-typed [Transit] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun transit(transit: JsonField<Transit>) = apply { this.transit = transit }

                    /** An unknown additional amount. */
                    fun unknown(unknown: Unknown?) = unknown(JsonField.ofNullable(unknown))

                    /** Alias for calling [Builder.unknown] with `unknown.orElse(null)`. */
                    fun unknown(unknown: Optional<Unknown>) = unknown(unknown.getOrNull())

                    /**
                     * Sets [Builder.unknown] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.unknown] with a well-typed [Unknown] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun unknown(unknown: JsonField<Unknown>) = apply { this.unknown = unknown }

                    /** The part of this transaction amount that was for vision-related services. */
                    fun vision(vision: Vision?) = vision(JsonField.ofNullable(vision))

                    /** Alias for calling [Builder.vision] with `vision.orElse(null)`. */
                    fun vision(vision: Optional<Vision>) = vision(vision.getOrNull())

                    /**
                     * Sets [Builder.vision] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.vision] with a well-typed [Vision] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun vision(vision: JsonField<Vision>) = apply { this.vision = vision }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [AdditionalAmounts].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .clinic()
                     * .dental()
                     * .original()
                     * .prescription()
                     * .surcharge()
                     * .totalCumulative()
                     * .totalHealthcare()
                     * .transit()
                     * .unknown()
                     * .vision()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): AdditionalAmounts =
                        AdditionalAmounts(
                            checkRequired("clinic", clinic),
                            checkRequired("dental", dental),
                            checkRequired("original", original),
                            checkRequired("prescription", prescription),
                            checkRequired("surcharge", surcharge),
                            checkRequired("totalCumulative", totalCumulative),
                            checkRequired("totalHealthcare", totalHealthcare),
                            checkRequired("transit", transit),
                            checkRequired("unknown", unknown),
                            checkRequired("vision", vision),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): AdditionalAmounts = apply {
                    if (validated) {
                        return@apply
                    }

                    clinic().ifPresent { it.validate() }
                    dental().ifPresent { it.validate() }
                    original().ifPresent { it.validate() }
                    prescription().ifPresent { it.validate() }
                    surcharge().ifPresent { it.validate() }
                    totalCumulative().ifPresent { it.validate() }
                    totalHealthcare().ifPresent { it.validate() }
                    transit().ifPresent { it.validate() }
                    unknown().ifPresent { it.validate() }
                    vision().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (clinic.asKnown().getOrNull()?.validity() ?: 0) +
                        (dental.asKnown().getOrNull()?.validity() ?: 0) +
                        (original.asKnown().getOrNull()?.validity() ?: 0) +
                        (prescription.asKnown().getOrNull()?.validity() ?: 0) +
                        (surcharge.asKnown().getOrNull()?.validity() ?: 0) +
                        (totalCumulative.asKnown().getOrNull()?.validity() ?: 0) +
                        (totalHealthcare.asKnown().getOrNull()?.validity() ?: 0) +
                        (transit.asKnown().getOrNull()?.validity() ?: 0) +
                        (unknown.asKnown().getOrNull()?.validity() ?: 0) +
                        (vision.asKnown().getOrNull()?.validity() ?: 0)

                /** The part of this transaction amount that was for clinic-related services. */
                class Clinic
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Clinic].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Clinic]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(clinic: Clinic) = apply {
                            amount = clinic.amount
                            currency = clinic.currency
                            additionalProperties = clinic.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Clinic].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Clinic =
                            Clinic(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Clinic = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Clinic &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Clinic{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for dental-related services. */
                class Dental
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Dental].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Dental]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(dental: Dental) = apply {
                            amount = dental.amount
                            currency = dental.currency
                            additionalProperties = dental.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Dental].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Dental =
                            Dental(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Dental = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Dental &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Dental{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The original pre-authorized amount. */
                class Original
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Original].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Original]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(original: Original) = apply {
                            amount = original.amount
                            currency = original.currency
                            additionalProperties = original.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Original].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Original =
                            Original(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Original = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Original &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Original{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for healthcare prescriptions. */
                class Prescription
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Prescription].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Prescription]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(prescription: Prescription) = apply {
                            amount = prescription.amount
                            currency = prescription.currency
                            additionalProperties = prescription.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Prescription].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Prescription =
                            Prescription(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Prescription = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Prescription &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Prescription{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The surcharge amount charged for this transaction by the merchant. */
                class Surcharge
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Surcharge].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Surcharge]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(surcharge: Surcharge) = apply {
                            amount = surcharge.amount
                            currency = surcharge.currency
                            additionalProperties = surcharge.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Surcharge].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Surcharge =
                            Surcharge(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Surcharge = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Surcharge &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Surcharge{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /**
                 * The total amount of a series of incremental authorizations, optionally provided.
                 */
                class TotalCumulative
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [TotalCumulative].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [TotalCumulative]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(totalCumulative: TotalCumulative) = apply {
                            amount = totalCumulative.amount
                            currency = totalCumulative.currency
                            additionalProperties =
                                totalCumulative.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [TotalCumulative].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): TotalCumulative =
                            TotalCumulative(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): TotalCumulative = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is TotalCumulative &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "TotalCumulative{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The total amount of healthcare-related additional amounts. */
                class TotalHealthcare
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [TotalHealthcare].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [TotalHealthcare]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(totalHealthcare: TotalHealthcare) = apply {
                            amount = totalHealthcare.amount
                            currency = totalHealthcare.currency
                            additionalProperties =
                                totalHealthcare.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [TotalHealthcare].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): TotalHealthcare =
                            TotalHealthcare(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): TotalHealthcare = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is TotalHealthcare &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "TotalHealthcare{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for transit-related services. */
                class Transit
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Transit].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Transit]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(transit: Transit) = apply {
                            amount = transit.amount
                            currency = transit.currency
                            additionalProperties = transit.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Transit].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Transit =
                            Transit(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Transit = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Transit &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Transit{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** An unknown additional amount. */
                class Unknown
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Unknown].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Unknown]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(unknown: Unknown) = apply {
                            amount = unknown.amount
                            currency = unknown.currency
                            additionalProperties = unknown.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Unknown].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Unknown =
                            Unknown(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Unknown = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Unknown &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Unknown{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                /** The part of this transaction amount that was for vision-related services. */
                class Vision
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val amount: JsonField<Long>,
                    private val currency: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("amount")
                        @ExcludeMissing
                        amount: JsonField<Long> = JsonMissing.of(),
                        @JsonProperty("currency")
                        @ExcludeMissing
                        currency: JsonField<String> = JsonMissing.of(),
                    ) : this(amount, currency, mutableMapOf())

                    /**
                     * The amount in minor units of the `currency` field. The amount is positive if
                     * it is added to the amount (such as an ATM surcharge fee) and negative if it
                     * is subtracted from the amount (such as a discount).
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun amount(): Long = amount.getRequired("amount")

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                     * additional amount's currency.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun currency(): String = currency.getRequired("currency")

                    /**
                     * Returns the raw JSON value of [amount].
                     *
                     * Unlike [amount], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<Long> = amount

                    /**
                     * Returns the raw JSON value of [currency].
                     *
                     * Unlike [currency], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun _currency(): JsonField<String> = currency

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Vision].
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Vision]. */
                    class Builder internal constructor() {

                        private var amount: JsonField<Long>? = null
                        private var currency: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(vision: Vision) = apply {
                            amount = vision.amount
                            currency = vision.currency
                            additionalProperties = vision.additionalProperties.toMutableMap()
                        }

                        /**
                         * The amount in minor units of the `currency` field. The amount is positive
                         * if it is added to the amount (such as an ATM surcharge fee) and negative
                         * if it is subtracted from the amount (such as a discount).
                         */
                        fun amount(amount: Long) = amount(JsonField.of(amount))

                        /**
                         * Sets [Builder.amount] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.amount] with a well-typed [Long] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun amount(amount: JsonField<Long>) = apply { this.amount = amount }

                        /**
                         * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the
                         * additional amount's currency.
                         */
                        fun currency(currency: String) = currency(JsonField.of(currency))

                        /**
                         * Sets [Builder.currency] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.currency] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun currency(currency: JsonField<String>) = apply {
                            this.currency = currency
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Vision].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .amount()
                         * .currency()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Vision =
                            Vision(
                                checkRequired("amount", amount),
                                checkRequired("currency", currency),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Vision = apply {
                        if (validated) {
                            return@apply
                        }

                        amount()
                        currency()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (amount.asKnown().isPresent) 1 else 0) +
                            (if (currency.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Vision &&
                            amount == other.amount &&
                            currency == other.currency &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(amount, currency, additionalProperties)
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Vision{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is AdditionalAmounts &&
                        clinic == other.clinic &&
                        dental == other.dental &&
                        original == other.original &&
                        prescription == other.prescription &&
                        surcharge == other.surcharge &&
                        totalCumulative == other.totalCumulative &&
                        totalHealthcare == other.totalHealthcare &&
                        transit == other.transit &&
                        unknown == other.unknown &&
                        vision == other.vision &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        clinic,
                        dental,
                        original,
                        prescription,
                        surcharge,
                        totalCumulative,
                        totalHealthcare,
                        transit,
                        unknown,
                        vision,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "AdditionalAmounts{clinic=$clinic, dental=$dental, original=$original, prescription=$prescription, surcharge=$surcharge, totalCumulative=$totalCumulative, totalHealthcare=$totalHealthcare, transit=$transit, unknown=$unknown, vision=$vision, additionalProperties=$additionalProperties}"
            }

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's
             * currency.
             */
            class Currency @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    /** US Dollar (USD) */
                    @JvmField val USD = of("USD")

                    @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                }

                /** An enum containing [Currency]'s known values. */
                enum class Known {
                    /** US Dollar (USD) */
                    USD
                }

                /**
                 * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Currency] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    /** US Dollar (USD) */
                    USD,
                    /**
                     * An enum member indicating that [Currency] was instantiated with an unknown
                     * value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        USD -> Value.USD
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        USD -> Known.USD
                        else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Currency = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Currency && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** Fields specific to the `network`. */
            class NetworkDetails
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val category: JsonField<Category>,
                private val pulse: JsonField<Pulse>,
                private val visa: JsonField<Visa>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("category")
                    @ExcludeMissing
                    category: JsonField<Category> = JsonMissing.of(),
                    @JsonProperty("pulse")
                    @ExcludeMissing
                    pulse: JsonField<Pulse> = JsonMissing.of(),
                    @JsonProperty("visa") @ExcludeMissing visa: JsonField<Visa> = JsonMissing.of(),
                ) : this(category, pulse, visa, mutableMapOf())

                /**
                 * The payment network used to process this card authorization.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun category(): Category = category.getRequired("category")

                /**
                 * Fields specific to the `pulse` network.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun pulse(): Optional<Pulse> = pulse.getOptional("pulse")

                /**
                 * Fields specific to the `visa` network.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun visa(): Optional<Visa> = visa.getOptional("visa")

                /**
                 * Returns the raw JSON value of [category].
                 *
                 * Unlike [category], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("category")
                @ExcludeMissing
                fun _category(): JsonField<Category> = category

                /**
                 * Returns the raw JSON value of [pulse].
                 *
                 * Unlike [pulse], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("pulse") @ExcludeMissing fun _pulse(): JsonField<Pulse> = pulse

                /**
                 * Returns the raw JSON value of [visa].
                 *
                 * Unlike [visa], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("visa") @ExcludeMissing fun _visa(): JsonField<Visa> = visa

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [NetworkDetails].
                     *
                     * The following fields are required:
                     * ```java
                     * .category()
                     * .pulse()
                     * .visa()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [NetworkDetails]. */
                class Builder internal constructor() {

                    private var category: JsonField<Category>? = null
                    private var pulse: JsonField<Pulse>? = null
                    private var visa: JsonField<Visa>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(networkDetails: NetworkDetails) = apply {
                        category = networkDetails.category
                        pulse = networkDetails.pulse
                        visa = networkDetails.visa
                        additionalProperties = networkDetails.additionalProperties.toMutableMap()
                    }

                    /** The payment network used to process this card authorization. */
                    fun category(category: Category) = category(JsonField.of(category))

                    /**
                     * Sets [Builder.category] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.category] with a well-typed [Category] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun category(category: JsonField<Category>) = apply { this.category = category }

                    /** Fields specific to the `pulse` network. */
                    fun pulse(pulse: Pulse?) = pulse(JsonField.ofNullable(pulse))

                    /** Alias for calling [Builder.pulse] with `pulse.orElse(null)`. */
                    fun pulse(pulse: Optional<Pulse>) = pulse(pulse.getOrNull())

                    /**
                     * Sets [Builder.pulse] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.pulse] with a well-typed [Pulse] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun pulse(pulse: JsonField<Pulse>) = apply { this.pulse = pulse }

                    /** Fields specific to the `visa` network. */
                    fun visa(visa: Visa?) = visa(JsonField.ofNullable(visa))

                    /** Alias for calling [Builder.visa] with `visa.orElse(null)`. */
                    fun visa(visa: Optional<Visa>) = visa(visa.getOrNull())

                    /**
                     * Sets [Builder.visa] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.visa] with a well-typed [Visa] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun visa(visa: JsonField<Visa>) = apply { this.visa = visa }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [NetworkDetails].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .category()
                     * .pulse()
                     * .visa()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): NetworkDetails =
                        NetworkDetails(
                            checkRequired("category", category),
                            checkRequired("pulse", pulse),
                            checkRequired("visa", visa),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): NetworkDetails = apply {
                    if (validated) {
                        return@apply
                    }

                    category().validate()
                    pulse().ifPresent { it.validate() }
                    visa().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (category.asKnown().getOrNull()?.validity() ?: 0) +
                        (pulse.asKnown().getOrNull()?.validity() ?: 0) +
                        (visa.asKnown().getOrNull()?.validity() ?: 0)

                /** The payment network used to process this card authorization. */
                class Category
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** Visa */
                        @JvmField val VISA = of("visa")

                        /** Pulse */
                        @JvmField val PULSE = of("pulse")

                        @JvmStatic fun of(value: String) = Category(JsonField.of(value))
                    }

                    /** An enum containing [Category]'s known values. */
                    enum class Known {
                        /** Visa */
                        VISA,
                        /** Pulse */
                        PULSE,
                    }

                    /**
                     * An enum containing [Category]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Category] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** Visa */
                        VISA,
                        /** Pulse */
                        PULSE,
                        /**
                         * An enum member indicating that [Category] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            VISA -> Value.VISA
                            PULSE -> Value.PULSE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            VISA -> Known.VISA
                            PULSE -> Known.PULSE
                            else -> throw IncreaseInvalidDataException("Unknown Category: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Category = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Category && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** Fields specific to the `pulse` network. */
                class Pulse
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val additionalProperties: MutableMap<String, JsonValue>
                ) {

                    @JsonCreator private constructor() : this(mutableMapOf())

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /** Returns a mutable builder for constructing an instance of [Pulse]. */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Pulse]. */
                    class Builder internal constructor() {

                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(pulse: Pulse) = apply {
                            additionalProperties = pulse.additionalProperties.toMutableMap()
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Pulse].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         */
                        fun build(): Pulse = Pulse(additionalProperties.toMutableMap())
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Pulse = apply {
                        if (validated) {
                            return@apply
                        }

                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic internal fun validity(): Int = 0

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Pulse && additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy { Objects.hash(additionalProperties) }

                    override fun hashCode(): Int = hashCode

                    override fun toString() = "Pulse{additionalProperties=$additionalProperties}"
                }

                /** Fields specific to the `visa` network. */
                class Visa
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val electronicCommerceIndicator: JsonField<ElectronicCommerceIndicator>,
                    private val pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode>,
                    private val standInProcessingReason: JsonField<StandInProcessingReason>,
                    private val terminalEntryCapability: JsonField<TerminalEntryCapability>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("electronic_commerce_indicator")
                        @ExcludeMissing
                        electronicCommerceIndicator: JsonField<ElectronicCommerceIndicator> =
                            JsonMissing.of(),
                        @JsonProperty("point_of_service_entry_mode")
                        @ExcludeMissing
                        pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode> =
                            JsonMissing.of(),
                        @JsonProperty("stand_in_processing_reason")
                        @ExcludeMissing
                        standInProcessingReason: JsonField<StandInProcessingReason> =
                            JsonMissing.of(),
                        @JsonProperty("terminal_entry_capability")
                        @ExcludeMissing
                        terminalEntryCapability: JsonField<TerminalEntryCapability> =
                            JsonMissing.of(),
                    ) : this(
                        electronicCommerceIndicator,
                        pointOfServiceEntryMode,
                        standInProcessingReason,
                        terminalEntryCapability,
                        mutableMapOf(),
                    )

                    /**
                     * For electronic commerce transactions, this identifies the level of security
                     * used in obtaining the customer's payment credential. For mail or telephone
                     * order transactions, identifies the type of mail or telephone order.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun electronicCommerceIndicator(): Optional<ElectronicCommerceIndicator> =
                        electronicCommerceIndicator.getOptional("electronic_commerce_indicator")

                    /**
                     * The method used to enter the cardholder's primary account number and card
                     * expiration date.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun pointOfServiceEntryMode(): Optional<PointOfServiceEntryMode> =
                        pointOfServiceEntryMode.getOptional("point_of_service_entry_mode")

                    /**
                     * Only present when `actioner: network`. Describes why a card authorization was
                     * approved or declined by Visa through stand-in processing.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun standInProcessingReason(): Optional<StandInProcessingReason> =
                        standInProcessingReason.getOptional("stand_in_processing_reason")

                    /**
                     * The capability of the terminal being used to read the card. Shows whether a
                     * terminal can e.g., accept chip cards or if it only supports magnetic stripe
                     * reads. This reflects the highest capability of the terminal — for example, a
                     * terminal that supports both chip and magnetic stripe will be identified as
                     * chip-capable.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun terminalEntryCapability(): Optional<TerminalEntryCapability> =
                        terminalEntryCapability.getOptional("terminal_entry_capability")

                    /**
                     * Returns the raw JSON value of [electronicCommerceIndicator].
                     *
                     * Unlike [electronicCommerceIndicator], this method doesn't throw if the JSON
                     * field has an unexpected type.
                     */
                    @JsonProperty("electronic_commerce_indicator")
                    @ExcludeMissing
                    fun _electronicCommerceIndicator(): JsonField<ElectronicCommerceIndicator> =
                        electronicCommerceIndicator

                    /**
                     * Returns the raw JSON value of [pointOfServiceEntryMode].
                     *
                     * Unlike [pointOfServiceEntryMode], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("point_of_service_entry_mode")
                    @ExcludeMissing
                    fun _pointOfServiceEntryMode(): JsonField<PointOfServiceEntryMode> =
                        pointOfServiceEntryMode

                    /**
                     * Returns the raw JSON value of [standInProcessingReason].
                     *
                     * Unlike [standInProcessingReason], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("stand_in_processing_reason")
                    @ExcludeMissing
                    fun _standInProcessingReason(): JsonField<StandInProcessingReason> =
                        standInProcessingReason

                    /**
                     * Returns the raw JSON value of [terminalEntryCapability].
                     *
                     * Unlike [terminalEntryCapability], this method doesn't throw if the JSON field
                     * has an unexpected type.
                     */
                    @JsonProperty("terminal_entry_capability")
                    @ExcludeMissing
                    fun _terminalEntryCapability(): JsonField<TerminalEntryCapability> =
                        terminalEntryCapability

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of [Visa].
                         *
                         * The following fields are required:
                         * ```java
                         * .electronicCommerceIndicator()
                         * .pointOfServiceEntryMode()
                         * .standInProcessingReason()
                         * .terminalEntryCapability()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [Visa]. */
                    class Builder internal constructor() {

                        private var electronicCommerceIndicator:
                            JsonField<ElectronicCommerceIndicator>? =
                            null
                        private var pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode>? =
                            null
                        private var standInProcessingReason: JsonField<StandInProcessingReason>? =
                            null
                        private var terminalEntryCapability: JsonField<TerminalEntryCapability>? =
                            null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(visa: Visa) = apply {
                            electronicCommerceIndicator = visa.electronicCommerceIndicator
                            pointOfServiceEntryMode = visa.pointOfServiceEntryMode
                            standInProcessingReason = visa.standInProcessingReason
                            terminalEntryCapability = visa.terminalEntryCapability
                            additionalProperties = visa.additionalProperties.toMutableMap()
                        }

                        /**
                         * For electronic commerce transactions, this identifies the level of
                         * security used in obtaining the customer's payment credential. For mail or
                         * telephone order transactions, identifies the type of mail or telephone
                         * order.
                         */
                        fun electronicCommerceIndicator(
                            electronicCommerceIndicator: ElectronicCommerceIndicator?
                        ) =
                            electronicCommerceIndicator(
                                JsonField.ofNullable(electronicCommerceIndicator)
                            )

                        /**
                         * Alias for calling [Builder.electronicCommerceIndicator] with
                         * `electronicCommerceIndicator.orElse(null)`.
                         */
                        fun electronicCommerceIndicator(
                            electronicCommerceIndicator: Optional<ElectronicCommerceIndicator>
                        ) = electronicCommerceIndicator(electronicCommerceIndicator.getOrNull())

                        /**
                         * Sets [Builder.electronicCommerceIndicator] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.electronicCommerceIndicator] with a
                         * well-typed [ElectronicCommerceIndicator] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun electronicCommerceIndicator(
                            electronicCommerceIndicator: JsonField<ElectronicCommerceIndicator>
                        ) = apply { this.electronicCommerceIndicator = electronicCommerceIndicator }

                        /**
                         * The method used to enter the cardholder's primary account number and card
                         * expiration date.
                         */
                        fun pointOfServiceEntryMode(
                            pointOfServiceEntryMode: PointOfServiceEntryMode?
                        ) = pointOfServiceEntryMode(JsonField.ofNullable(pointOfServiceEntryMode))

                        /**
                         * Alias for calling [Builder.pointOfServiceEntryMode] with
                         * `pointOfServiceEntryMode.orElse(null)`.
                         */
                        fun pointOfServiceEntryMode(
                            pointOfServiceEntryMode: Optional<PointOfServiceEntryMode>
                        ) = pointOfServiceEntryMode(pointOfServiceEntryMode.getOrNull())

                        /**
                         * Sets [Builder.pointOfServiceEntryMode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.pointOfServiceEntryMode] with a
                         * well-typed [PointOfServiceEntryMode] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun pointOfServiceEntryMode(
                            pointOfServiceEntryMode: JsonField<PointOfServiceEntryMode>
                        ) = apply { this.pointOfServiceEntryMode = pointOfServiceEntryMode }

                        /**
                         * Only present when `actioner: network`. Describes why a card authorization
                         * was approved or declined by Visa through stand-in processing.
                         */
                        fun standInProcessingReason(
                            standInProcessingReason: StandInProcessingReason?
                        ) = standInProcessingReason(JsonField.ofNullable(standInProcessingReason))

                        /**
                         * Alias for calling [Builder.standInProcessingReason] with
                         * `standInProcessingReason.orElse(null)`.
                         */
                        fun standInProcessingReason(
                            standInProcessingReason: Optional<StandInProcessingReason>
                        ) = standInProcessingReason(standInProcessingReason.getOrNull())

                        /**
                         * Sets [Builder.standInProcessingReason] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.standInProcessingReason] with a
                         * well-typed [StandInProcessingReason] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun standInProcessingReason(
                            standInProcessingReason: JsonField<StandInProcessingReason>
                        ) = apply { this.standInProcessingReason = standInProcessingReason }

                        /**
                         * The capability of the terminal being used to read the card. Shows whether
                         * a terminal can e.g., accept chip cards or if it only supports magnetic
                         * stripe reads. This reflects the highest capability of the terminal — for
                         * example, a terminal that supports both chip and magnetic stripe will be
                         * identified as chip-capable.
                         */
                        fun terminalEntryCapability(
                            terminalEntryCapability: TerminalEntryCapability?
                        ) = terminalEntryCapability(JsonField.ofNullable(terminalEntryCapability))

                        /**
                         * Alias for calling [Builder.terminalEntryCapability] with
                         * `terminalEntryCapability.orElse(null)`.
                         */
                        fun terminalEntryCapability(
                            terminalEntryCapability: Optional<TerminalEntryCapability>
                        ) = terminalEntryCapability(terminalEntryCapability.getOrNull())

                        /**
                         * Sets [Builder.terminalEntryCapability] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.terminalEntryCapability] with a
                         * well-typed [TerminalEntryCapability] value instead. This method is
                         * primarily for setting the field to an undocumented or not yet supported
                         * value.
                         */
                        fun terminalEntryCapability(
                            terminalEntryCapability: JsonField<TerminalEntryCapability>
                        ) = apply { this.terminalEntryCapability = terminalEntryCapability }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [Visa].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .electronicCommerceIndicator()
                         * .pointOfServiceEntryMode()
                         * .standInProcessingReason()
                         * .terminalEntryCapability()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Visa =
                            Visa(
                                checkRequired(
                                    "electronicCommerceIndicator",
                                    electronicCommerceIndicator,
                                ),
                                checkRequired("pointOfServiceEntryMode", pointOfServiceEntryMode),
                                checkRequired("standInProcessingReason", standInProcessingReason),
                                checkRequired("terminalEntryCapability", terminalEntryCapability),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Visa = apply {
                        if (validated) {
                            return@apply
                        }

                        electronicCommerceIndicator().ifPresent { it.validate() }
                        pointOfServiceEntryMode().ifPresent { it.validate() }
                        standInProcessingReason().ifPresent { it.validate() }
                        terminalEntryCapability().ifPresent { it.validate() }
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (electronicCommerceIndicator.asKnown().getOrNull()?.validity() ?: 0) +
                            (pointOfServiceEntryMode.asKnown().getOrNull()?.validity() ?: 0) +
                            (standInProcessingReason.asKnown().getOrNull()?.validity() ?: 0) +
                            (terminalEntryCapability.asKnown().getOrNull()?.validity() ?: 0)

                    /**
                     * For electronic commerce transactions, this identifies the level of security
                     * used in obtaining the customer's payment credential. For mail or telephone
                     * order transactions, identifies the type of mail or telephone order.
                     */
                    class ElectronicCommerceIndicator
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /**
                             * Single transaction of a mail/phone order: Use to indicate that the
                             * transaction is a mail/phone order purchase, not a recurring
                             * transaction or installment payment. For domestic transactions in the
                             * US region, this value may also indicate one bill payment transaction
                             * in the card-present or card-absent environments.
                             */
                            @JvmField val MAIL_PHONE_ORDER = of("mail_phone_order")

                            /**
                             * Recurring transaction: Payment indicator used to indicate a recurring
                             * transaction that originates from an acquirer in the US region.
                             */
                            @JvmField val RECURRING = of("recurring")

                            /**
                             * Installment payment: Payment indicator used to indicate one purchase
                             * of goods or services that is billed to the account in multiple
                             * charges over a period of time agreed upon by the cardholder and
                             * merchant from transactions that originate from an acquirer in the US
                             * region.
                             */
                            @JvmField val INSTALLMENT = of("installment")

                            /**
                             * Unknown classification: other mail order: Use to indicate that the
                             * type of mail/telephone order is unknown.
                             */
                            @JvmField val UNKNOWN_MAIL_PHONE_ORDER = of("unknown_mail_phone_order")

                            /**
                             * Secure electronic commerce transaction: Use to indicate that the
                             * electronic commerce transaction has been authenticated using e.g.,
                             * 3-D Secure
                             */
                            @JvmField
                            val SECURE_ELECTRONIC_COMMERCE = of("secure_electronic_commerce")

                            /**
                             * Non-authenticated security transaction at a 3-D Secure-capable
                             * merchant, and merchant attempted to authenticate the cardholder using
                             * 3-D Secure: Use to identify an electronic commerce transaction where
                             * the merchant attempted to authenticate the cardholder using 3-D
                             * Secure, but was unable to complete the authentication because the
                             * issuer or cardholder does not participate in the 3-D Secure program.
                             */
                            @JvmField
                            val NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT =
                                of("non_authenticated_security_transaction_at_3ds_capable_merchant")

                            /**
                             * Non-authenticated security transaction: Use to identify an electronic
                             * commerce transaction that uses data encryption for security however,
                             * cardholder authentication is not performed using 3-D Secure.
                             */
                            @JvmField
                            val NON_AUTHENTICATED_SECURITY_TRANSACTION =
                                of("non_authenticated_security_transaction")

                            /**
                             * Non-secure transaction: Use to identify an electronic commerce
                             * transaction that has no data protection.
                             */
                            @JvmField val NON_SECURE_TRANSACTION = of("non_secure_transaction")

                            @JvmStatic
                            fun of(value: String) = ElectronicCommerceIndicator(JsonField.of(value))
                        }

                        /** An enum containing [ElectronicCommerceIndicator]'s known values. */
                        enum class Known {
                            /**
                             * Single transaction of a mail/phone order: Use to indicate that the
                             * transaction is a mail/phone order purchase, not a recurring
                             * transaction or installment payment. For domestic transactions in the
                             * US region, this value may also indicate one bill payment transaction
                             * in the card-present or card-absent environments.
                             */
                            MAIL_PHONE_ORDER,
                            /**
                             * Recurring transaction: Payment indicator used to indicate a recurring
                             * transaction that originates from an acquirer in the US region.
                             */
                            RECURRING,
                            /**
                             * Installment payment: Payment indicator used to indicate one purchase
                             * of goods or services that is billed to the account in multiple
                             * charges over a period of time agreed upon by the cardholder and
                             * merchant from transactions that originate from an acquirer in the US
                             * region.
                             */
                            INSTALLMENT,
                            /**
                             * Unknown classification: other mail order: Use to indicate that the
                             * type of mail/telephone order is unknown.
                             */
                            UNKNOWN_MAIL_PHONE_ORDER,
                            /**
                             * Secure electronic commerce transaction: Use to indicate that the
                             * electronic commerce transaction has been authenticated using e.g.,
                             * 3-D Secure
                             */
                            SECURE_ELECTRONIC_COMMERCE,
                            /**
                             * Non-authenticated security transaction at a 3-D Secure-capable
                             * merchant, and merchant attempted to authenticate the cardholder using
                             * 3-D Secure: Use to identify an electronic commerce transaction where
                             * the merchant attempted to authenticate the cardholder using 3-D
                             * Secure, but was unable to complete the authentication because the
                             * issuer or cardholder does not participate in the 3-D Secure program.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT,
                            /**
                             * Non-authenticated security transaction: Use to identify an electronic
                             * commerce transaction that uses data encryption for security however,
                             * cardholder authentication is not performed using 3-D Secure.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION,
                            /**
                             * Non-secure transaction: Use to identify an electronic commerce
                             * transaction that has no data protection.
                             */
                            NON_SECURE_TRANSACTION,
                        }

                        /**
                         * An enum containing [ElectronicCommerceIndicator]'s known values, as well
                         * as an [_UNKNOWN] member.
                         *
                         * An instance of [ElectronicCommerceIndicator] can contain an unknown value
                         * in a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /**
                             * Single transaction of a mail/phone order: Use to indicate that the
                             * transaction is a mail/phone order purchase, not a recurring
                             * transaction or installment payment. For domestic transactions in the
                             * US region, this value may also indicate one bill payment transaction
                             * in the card-present or card-absent environments.
                             */
                            MAIL_PHONE_ORDER,
                            /**
                             * Recurring transaction: Payment indicator used to indicate a recurring
                             * transaction that originates from an acquirer in the US region.
                             */
                            RECURRING,
                            /**
                             * Installment payment: Payment indicator used to indicate one purchase
                             * of goods or services that is billed to the account in multiple
                             * charges over a period of time agreed upon by the cardholder and
                             * merchant from transactions that originate from an acquirer in the US
                             * region.
                             */
                            INSTALLMENT,
                            /**
                             * Unknown classification: other mail order: Use to indicate that the
                             * type of mail/telephone order is unknown.
                             */
                            UNKNOWN_MAIL_PHONE_ORDER,
                            /**
                             * Secure electronic commerce transaction: Use to indicate that the
                             * electronic commerce transaction has been authenticated using e.g.,
                             * 3-D Secure
                             */
                            SECURE_ELECTRONIC_COMMERCE,
                            /**
                             * Non-authenticated security transaction at a 3-D Secure-capable
                             * merchant, and merchant attempted to authenticate the cardholder using
                             * 3-D Secure: Use to identify an electronic commerce transaction where
                             * the merchant attempted to authenticate the cardholder using 3-D
                             * Secure, but was unable to complete the authentication because the
                             * issuer or cardholder does not participate in the 3-D Secure program.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT,
                            /**
                             * Non-authenticated security transaction: Use to identify an electronic
                             * commerce transaction that uses data encryption for security however,
                             * cardholder authentication is not performed using 3-D Secure.
                             */
                            NON_AUTHENTICATED_SECURITY_TRANSACTION,
                            /**
                             * Non-secure transaction: Use to identify an electronic commerce
                             * transaction that has no data protection.
                             */
                            NON_SECURE_TRANSACTION,
                            /**
                             * An enum member indicating that [ElectronicCommerceIndicator] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                MAIL_PHONE_ORDER -> Value.MAIL_PHONE_ORDER
                                RECURRING -> Value.RECURRING
                                INSTALLMENT -> Value.INSTALLMENT
                                UNKNOWN_MAIL_PHONE_ORDER -> Value.UNKNOWN_MAIL_PHONE_ORDER
                                SECURE_ELECTRONIC_COMMERCE -> Value.SECURE_ELECTRONIC_COMMERCE
                                NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT ->
                                    Value
                                        .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT
                                NON_AUTHENTICATED_SECURITY_TRANSACTION ->
                                    Value.NON_AUTHENTICATED_SECURITY_TRANSACTION
                                NON_SECURE_TRANSACTION -> Value.NON_SECURE_TRANSACTION
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                MAIL_PHONE_ORDER -> Known.MAIL_PHONE_ORDER
                                RECURRING -> Known.RECURRING
                                INSTALLMENT -> Known.INSTALLMENT
                                UNKNOWN_MAIL_PHONE_ORDER -> Known.UNKNOWN_MAIL_PHONE_ORDER
                                SECURE_ELECTRONIC_COMMERCE -> Known.SECURE_ELECTRONIC_COMMERCE
                                NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT ->
                                    Known
                                        .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT
                                NON_AUTHENTICATED_SECURITY_TRANSACTION ->
                                    Known.NON_AUTHENTICATED_SECURITY_TRANSACTION
                                NON_SECURE_TRANSACTION -> Known.NON_SECURE_TRANSACTION
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown ElectronicCommerceIndicator: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): ElectronicCommerceIndicator = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is ElectronicCommerceIndicator && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * The method used to enter the cardholder's primary account number and card
                     * expiration date.
                     */
                    class PointOfServiceEntryMode
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Unknown */
                            @JvmField val UNKNOWN = of("unknown")

                            /** Manual key entry */
                            @JvmField val MANUAL = of("manual")

                            /** Magnetic stripe read, without card verification value */
                            @JvmField val MAGNETIC_STRIPE_NO_CVV = of("magnetic_stripe_no_cvv")

                            /** Optical code */
                            @JvmField val OPTICAL_CODE = of("optical_code")

                            /** Contact chip card */
                            @JvmField val INTEGRATED_CIRCUIT_CARD = of("integrated_circuit_card")

                            /** Contactless read of chip card */
                            @JvmField val CONTACTLESS = of("contactless")

                            /**
                             * Transaction initiated using a credential that has previously been
                             * stored on file
                             */
                            @JvmField val CREDENTIAL_ON_FILE = of("credential_on_file")

                            /** Magnetic stripe read */
                            @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe")

                            /** Contactless read of magnetic stripe data */
                            @JvmField
                            val CONTACTLESS_MAGNETIC_STRIPE = of("contactless_magnetic_stripe")

                            /** Contact chip card, without card verification value */
                            @JvmField
                            val INTEGRATED_CIRCUIT_CARD_NO_CVV =
                                of("integrated_circuit_card_no_cvv")

                            @JvmStatic
                            fun of(value: String) = PointOfServiceEntryMode(JsonField.of(value))
                        }

                        /** An enum containing [PointOfServiceEntryMode]'s known values. */
                        enum class Known {
                            /** Unknown */
                            UNKNOWN,
                            /** Manual key entry */
                            MANUAL,
                            /** Magnetic stripe read, without card verification value */
                            MAGNETIC_STRIPE_NO_CVV,
                            /** Optical code */
                            OPTICAL_CODE,
                            /** Contact chip card */
                            INTEGRATED_CIRCUIT_CARD,
                            /** Contactless read of chip card */
                            CONTACTLESS,
                            /**
                             * Transaction initiated using a credential that has previously been
                             * stored on file
                             */
                            CREDENTIAL_ON_FILE,
                            /** Magnetic stripe read */
                            MAGNETIC_STRIPE,
                            /** Contactless read of magnetic stripe data */
                            CONTACTLESS_MAGNETIC_STRIPE,
                            /** Contact chip card, without card verification value */
                            INTEGRATED_CIRCUIT_CARD_NO_CVV,
                        }

                        /**
                         * An enum containing [PointOfServiceEntryMode]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [PointOfServiceEntryMode] can contain an unknown value in
                         * a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Unknown */
                            UNKNOWN,
                            /** Manual key entry */
                            MANUAL,
                            /** Magnetic stripe read, without card verification value */
                            MAGNETIC_STRIPE_NO_CVV,
                            /** Optical code */
                            OPTICAL_CODE,
                            /** Contact chip card */
                            INTEGRATED_CIRCUIT_CARD,
                            /** Contactless read of chip card */
                            CONTACTLESS,
                            /**
                             * Transaction initiated using a credential that has previously been
                             * stored on file
                             */
                            CREDENTIAL_ON_FILE,
                            /** Magnetic stripe read */
                            MAGNETIC_STRIPE,
                            /** Contactless read of magnetic stripe data */
                            CONTACTLESS_MAGNETIC_STRIPE,
                            /** Contact chip card, without card verification value */
                            INTEGRATED_CIRCUIT_CARD_NO_CVV,
                            /**
                             * An enum member indicating that [PointOfServiceEntryMode] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                UNKNOWN -> Value.UNKNOWN
                                MANUAL -> Value.MANUAL
                                MAGNETIC_STRIPE_NO_CVV -> Value.MAGNETIC_STRIPE_NO_CVV
                                OPTICAL_CODE -> Value.OPTICAL_CODE
                                INTEGRATED_CIRCUIT_CARD -> Value.INTEGRATED_CIRCUIT_CARD
                                CONTACTLESS -> Value.CONTACTLESS
                                CREDENTIAL_ON_FILE -> Value.CREDENTIAL_ON_FILE
                                MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE
                                CONTACTLESS_MAGNETIC_STRIPE -> Value.CONTACTLESS_MAGNETIC_STRIPE
                                INTEGRATED_CIRCUIT_CARD_NO_CVV ->
                                    Value.INTEGRATED_CIRCUIT_CARD_NO_CVV
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                UNKNOWN -> Known.UNKNOWN
                                MANUAL -> Known.MANUAL
                                MAGNETIC_STRIPE_NO_CVV -> Known.MAGNETIC_STRIPE_NO_CVV
                                OPTICAL_CODE -> Known.OPTICAL_CODE
                                INTEGRATED_CIRCUIT_CARD -> Known.INTEGRATED_CIRCUIT_CARD
                                CONTACTLESS -> Known.CONTACTLESS
                                CREDENTIAL_ON_FILE -> Known.CREDENTIAL_ON_FILE
                                MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE
                                CONTACTLESS_MAGNETIC_STRIPE -> Known.CONTACTLESS_MAGNETIC_STRIPE
                                INTEGRATED_CIRCUIT_CARD_NO_CVV ->
                                    Known.INTEGRATED_CIRCUIT_CARD_NO_CVV
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown PointOfServiceEntryMode: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): PointOfServiceEntryMode = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is PointOfServiceEntryMode && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * Only present when `actioner: network`. Describes why a card authorization was
                     * approved or declined by Visa through stand-in processing.
                     */
                    class StandInProcessingReason
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Increase failed to process the authorization in a timely manner. */
                            @JvmField val ISSUER_ERROR = of("issuer_error")

                            /** The physical card read had an invalid CVV or dCVV. */
                            @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card")

                            /**
                             * The card's authorization request cryptogram was invalid. The
                             * cryptogram can be from a physical card or a Digital Wallet Token
                             * purchase.
                             */
                            @JvmField val INVALID_CRYPTOGRAM = of("invalid_cryptogram")

                            /** The 3DS cardholder authentication verification value was invalid. */
                            @JvmField
                            val INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE =
                                of("invalid_cardholder_authentication_verification_value")

                            /**
                             * An internal Visa error occurred. Visa uses this reason code for
                             * certain expected occurrences as well, such as Application Transaction
                             * Counter (ATC) replays.
                             */
                            @JvmField val INTERNAL_VISA_ERROR = of("internal_visa_error")

                            /**
                             * The merchant has enabled Visa's Transaction Advisory Service and
                             * requires further authentication to perform the transaction. In
                             * practice this is often utilized at fuel pumps to tell the cardholder
                             * to see the cashier.
                             */
                            @JvmField
                            val MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED =
                                of("merchant_transaction_advisory_service_authentication_required")

                            /**
                             * The transaction was blocked by Visa's Payment Fraud Disruption
                             * service due to fraudulent Acquirer behavior, such as card testing.
                             */
                            @JvmField
                            val PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK =
                                of("payment_fraud_disruption_acquirer_block")

                            /** An unspecific reason for stand-in processing. */
                            @JvmField val OTHER = of("other")

                            @JvmStatic
                            fun of(value: String) = StandInProcessingReason(JsonField.of(value))
                        }

                        /** An enum containing [StandInProcessingReason]'s known values. */
                        enum class Known {
                            /** Increase failed to process the authorization in a timely manner. */
                            ISSUER_ERROR,
                            /** The physical card read had an invalid CVV or dCVV. */
                            INVALID_PHYSICAL_CARD,
                            /**
                             * The card's authorization request cryptogram was invalid. The
                             * cryptogram can be from a physical card or a Digital Wallet Token
                             * purchase.
                             */
                            INVALID_CRYPTOGRAM,
                            /** The 3DS cardholder authentication verification value was invalid. */
                            INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE,
                            /**
                             * An internal Visa error occurred. Visa uses this reason code for
                             * certain expected occurrences as well, such as Application Transaction
                             * Counter (ATC) replays.
                             */
                            INTERNAL_VISA_ERROR,
                            /**
                             * The merchant has enabled Visa's Transaction Advisory Service and
                             * requires further authentication to perform the transaction. In
                             * practice this is often utilized at fuel pumps to tell the cardholder
                             * to see the cashier.
                             */
                            MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED,
                            /**
                             * The transaction was blocked by Visa's Payment Fraud Disruption
                             * service due to fraudulent Acquirer behavior, such as card testing.
                             */
                            PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK,
                            /** An unspecific reason for stand-in processing. */
                            OTHER,
                        }

                        /**
                         * An enum containing [StandInProcessingReason]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [StandInProcessingReason] can contain an unknown value in
                         * a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Increase failed to process the authorization in a timely manner. */
                            ISSUER_ERROR,
                            /** The physical card read had an invalid CVV or dCVV. */
                            INVALID_PHYSICAL_CARD,
                            /**
                             * The card's authorization request cryptogram was invalid. The
                             * cryptogram can be from a physical card or a Digital Wallet Token
                             * purchase.
                             */
                            INVALID_CRYPTOGRAM,
                            /** The 3DS cardholder authentication verification value was invalid. */
                            INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE,
                            /**
                             * An internal Visa error occurred. Visa uses this reason code for
                             * certain expected occurrences as well, such as Application Transaction
                             * Counter (ATC) replays.
                             */
                            INTERNAL_VISA_ERROR,
                            /**
                             * The merchant has enabled Visa's Transaction Advisory Service and
                             * requires further authentication to perform the transaction. In
                             * practice this is often utilized at fuel pumps to tell the cardholder
                             * to see the cashier.
                             */
                            MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED,
                            /**
                             * The transaction was blocked by Visa's Payment Fraud Disruption
                             * service due to fraudulent Acquirer behavior, such as card testing.
                             */
                            PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK,
                            /** An unspecific reason for stand-in processing. */
                            OTHER,
                            /**
                             * An enum member indicating that [StandInProcessingReason] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                ISSUER_ERROR -> Value.ISSUER_ERROR
                                INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD
                                INVALID_CRYPTOGRAM -> Value.INVALID_CRYPTOGRAM
                                INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE ->
                                    Value.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE
                                INTERNAL_VISA_ERROR -> Value.INTERNAL_VISA_ERROR
                                MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED ->
                                    Value
                                        .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED
                                PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK ->
                                    Value.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK
                                OTHER -> Value.OTHER
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                ISSUER_ERROR -> Known.ISSUER_ERROR
                                INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD
                                INVALID_CRYPTOGRAM -> Known.INVALID_CRYPTOGRAM
                                INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE ->
                                    Known.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE
                                INTERNAL_VISA_ERROR -> Known.INTERNAL_VISA_ERROR
                                MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED ->
                                    Known
                                        .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED
                                PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK ->
                                    Known.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK
                                OTHER -> Known.OTHER
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown StandInProcessingReason: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): StandInProcessingReason = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is StandInProcessingReason && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    /**
                     * The capability of the terminal being used to read the card. Shows whether a
                     * terminal can e.g., accept chip cards or if it only supports magnetic stripe
                     * reads. This reflects the highest capability of the terminal — for example, a
                     * terminal that supports both chip and magnetic stripe will be identified as
                     * chip-capable.
                     */
                    class TerminalEntryCapability
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** Unknown */
                            @JvmField val UNKNOWN = of("unknown")

                            /** No terminal was used for this transaction. */
                            @JvmField val TERMINAL_NOT_USED = of("terminal_not_used")

                            /**
                             * The terminal can only read magnetic stripes and does not have chip or
                             * contactless reading capability.
                             */
                            @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe")

                            /** The terminal can only read barcodes. */
                            @JvmField val BARCODE = of("barcode")

                            /**
                             * The terminal can only read cards via Optical Character Recognition.
                             */
                            @JvmField
                            val OPTICAL_CHARACTER_RECOGNITION = of("optical_character_recognition")

                            /**
                             * The terminal supports contact chip cards and can also read the
                             * magnetic stripe. If contact chip is supported, this value is used
                             * regardless of whether contactless is also supported.
                             */
                            @JvmField val CHIP_OR_CONTACTLESS = of("chip_or_contactless")

                            /**
                             * The terminal supports contactless reads but does not support contact
                             * chip. Only used when the terminal lacks contact chip capability.
                             */
                            @JvmField val CONTACTLESS_ONLY = of("contactless_only")

                            /** The terminal has no card reading capability. */
                            @JvmField val NO_CAPABILITY = of("no_capability")

                            @JvmStatic
                            fun of(value: String) = TerminalEntryCapability(JsonField.of(value))
                        }

                        /** An enum containing [TerminalEntryCapability]'s known values. */
                        enum class Known {
                            /** Unknown */
                            UNKNOWN,
                            /** No terminal was used for this transaction. */
                            TERMINAL_NOT_USED,
                            /**
                             * The terminal can only read magnetic stripes and does not have chip or
                             * contactless reading capability.
                             */
                            MAGNETIC_STRIPE,
                            /** The terminal can only read barcodes. */
                            BARCODE,
                            /**
                             * The terminal can only read cards via Optical Character Recognition.
                             */
                            OPTICAL_CHARACTER_RECOGNITION,
                            /**
                             * The terminal supports contact chip cards and can also read the
                             * magnetic stripe. If contact chip is supported, this value is used
                             * regardless of whether contactless is also supported.
                             */
                            CHIP_OR_CONTACTLESS,
                            /**
                             * The terminal supports contactless reads but does not support contact
                             * chip. Only used when the terminal lacks contact chip capability.
                             */
                            CONTACTLESS_ONLY,
                            /** The terminal has no card reading capability. */
                            NO_CAPABILITY,
                        }

                        /**
                         * An enum containing [TerminalEntryCapability]'s known values, as well as
                         * an [_UNKNOWN] member.
                         *
                         * An instance of [TerminalEntryCapability] can contain an unknown value in
                         * a couple of cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** Unknown */
                            UNKNOWN,
                            /** No terminal was used for this transaction. */
                            TERMINAL_NOT_USED,
                            /**
                             * The terminal can only read magnetic stripes and does not have chip or
                             * contactless reading capability.
                             */
                            MAGNETIC_STRIPE,
                            /** The terminal can only read barcodes. */
                            BARCODE,
                            /**
                             * The terminal can only read cards via Optical Character Recognition.
                             */
                            OPTICAL_CHARACTER_RECOGNITION,
                            /**
                             * The terminal supports contact chip cards and can also read the
                             * magnetic stripe. If contact chip is supported, this value is used
                             * regardless of whether contactless is also supported.
                             */
                            CHIP_OR_CONTACTLESS,
                            /**
                             * The terminal supports contactless reads but does not support contact
                             * chip. Only used when the terminal lacks contact chip capability.
                             */
                            CONTACTLESS_ONLY,
                            /** The terminal has no card reading capability. */
                            NO_CAPABILITY,
                            /**
                             * An enum member indicating that [TerminalEntryCapability] was
                             * instantiated with an unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                UNKNOWN -> Value.UNKNOWN
                                TERMINAL_NOT_USED -> Value.TERMINAL_NOT_USED
                                MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE
                                BARCODE -> Value.BARCODE
                                OPTICAL_CHARACTER_RECOGNITION -> Value.OPTICAL_CHARACTER_RECOGNITION
                                CHIP_OR_CONTACTLESS -> Value.CHIP_OR_CONTACTLESS
                                CONTACTLESS_ONLY -> Value.CONTACTLESS_ONLY
                                NO_CAPABILITY -> Value.NO_CAPABILITY
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                UNKNOWN -> Known.UNKNOWN
                                TERMINAL_NOT_USED -> Known.TERMINAL_NOT_USED
                                MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE
                                BARCODE -> Known.BARCODE
                                OPTICAL_CHARACTER_RECOGNITION -> Known.OPTICAL_CHARACTER_RECOGNITION
                                CHIP_OR_CONTACTLESS -> Known.CHIP_OR_CONTACTLESS
                                CONTACTLESS_ONLY -> Known.CONTACTLESS_ONLY
                                NO_CAPABILITY -> Known.NO_CAPABILITY
                                else ->
                                    throw IncreaseInvalidDataException(
                                        "Unknown TerminalEntryCapability: $value"
                                    )
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): TerminalEntryCapability = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is TerminalEntryCapability && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Visa &&
                            electronicCommerceIndicator == other.electronicCommerceIndicator &&
                            pointOfServiceEntryMode == other.pointOfServiceEntryMode &&
                            standInProcessingReason == other.standInProcessingReason &&
                            terminalEntryCapability == other.terminalEntryCapability &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            electronicCommerceIndicator,
                            pointOfServiceEntryMode,
                            standInProcessingReason,
                            terminalEntryCapability,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Visa{electronicCommerceIndicator=$electronicCommerceIndicator, pointOfServiceEntryMode=$pointOfServiceEntryMode, standInProcessingReason=$standInProcessingReason, terminalEntryCapability=$terminalEntryCapability, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is NetworkDetails &&
                        category == other.category &&
                        pulse == other.pulse &&
                        visa == other.visa &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(category, pulse, visa, additionalProperties)
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "NetworkDetails{category=$category, pulse=$pulse, visa=$visa, additionalProperties=$additionalProperties}"
            }

            /** Network-specific identifiers for a specific request or transaction. */
            class NetworkIdentifiers
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val authorizationIdentificationResponse: JsonField<String>,
                private val retrievalReferenceNumber: JsonField<String>,
                private val traceNumber: JsonField<String>,
                private val transactionId: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("authorization_identification_response")
                    @ExcludeMissing
                    authorizationIdentificationResponse: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("retrieval_reference_number")
                    @ExcludeMissing
                    retrievalReferenceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("trace_number")
                    @ExcludeMissing
                    traceNumber: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("transaction_id")
                    @ExcludeMissing
                    transactionId: JsonField<String> = JsonMissing.of(),
                ) : this(
                    authorizationIdentificationResponse,
                    retrievalReferenceNumber,
                    traceNumber,
                    transactionId,
                    mutableMapOf(),
                )

                /**
                 * The randomly generated 6-character Authorization Identification Response code
                 * sent back to the acquirer in an approved response.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun authorizationIdentificationResponse(): Optional<String> =
                    authorizationIdentificationResponse.getOptional(
                        "authorization_identification_response"
                    )

                /**
                 * A life-cycle identifier used across e.g., an authorization and a reversal.
                 * Expected to be unique per acquirer within a window of time. For some card
                 * networks the retrieval reference number includes the trace counter.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun retrievalReferenceNumber(): Optional<String> =
                    retrievalReferenceNumber.getOptional("retrieval_reference_number")

                /**
                 * A counter used to verify an individual authorization. Expected to be unique per
                 * acquirer within a window of time.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun traceNumber(): Optional<String> = traceNumber.getOptional("trace_number")

                /**
                 * A globally unique transaction identifier provided by the card network, used
                 * across multiple life-cycle requests.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun transactionId(): Optional<String> = transactionId.getOptional("transaction_id")

                /**
                 * Returns the raw JSON value of [authorizationIdentificationResponse].
                 *
                 * Unlike [authorizationIdentificationResponse], this method doesn't throw if the
                 * JSON field has an unexpected type.
                 */
                @JsonProperty("authorization_identification_response")
                @ExcludeMissing
                fun _authorizationIdentificationResponse(): JsonField<String> =
                    authorizationIdentificationResponse

                /**
                 * Returns the raw JSON value of [retrievalReferenceNumber].
                 *
                 * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field
                 * has an unexpected type.
                 */
                @JsonProperty("retrieval_reference_number")
                @ExcludeMissing
                fun _retrievalReferenceNumber(): JsonField<String> = retrievalReferenceNumber

                /**
                 * Returns the raw JSON value of [traceNumber].
                 *
                 * Unlike [traceNumber], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("trace_number")
                @ExcludeMissing
                fun _traceNumber(): JsonField<String> = traceNumber

                /**
                 * Returns the raw JSON value of [transactionId].
                 *
                 * Unlike [transactionId], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("transaction_id")
                @ExcludeMissing
                fun _transactionId(): JsonField<String> = transactionId

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of
                     * [NetworkIdentifiers].
                     *
                     * The following fields are required:
                     * ```java
                     * .authorizationIdentificationResponse()
                     * .retrievalReferenceNumber()
                     * .traceNumber()
                     * .transactionId()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [NetworkIdentifiers]. */
                class Builder internal constructor() {

                    private var authorizationIdentificationResponse: JsonField<String>? = null
                    private var retrievalReferenceNumber: JsonField<String>? = null
                    private var traceNumber: JsonField<String>? = null
                    private var transactionId: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(networkIdentifiers: NetworkIdentifiers) = apply {
                        authorizationIdentificationResponse =
                            networkIdentifiers.authorizationIdentificationResponse
                        retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber
                        traceNumber = networkIdentifiers.traceNumber
                        transactionId = networkIdentifiers.transactionId
                        additionalProperties =
                            networkIdentifiers.additionalProperties.toMutableMap()
                    }

                    /**
                     * The randomly generated 6-character Authorization Identification Response code
                     * sent back to the acquirer in an approved response.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: String?
                    ) =
                        authorizationIdentificationResponse(
                            JsonField.ofNullable(authorizationIdentificationResponse)
                        )

                    /**
                     * Alias for calling [Builder.authorizationIdentificationResponse] with
                     * `authorizationIdentificationResponse.orElse(null)`.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: Optional<String>
                    ) =
                        authorizationIdentificationResponse(
                            authorizationIdentificationResponse.getOrNull()
                        )

                    /**
                     * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON
                     * value.
                     *
                     * You should usually call [Builder.authorizationIdentificationResponse] with a
                     * well-typed [String] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun authorizationIdentificationResponse(
                        authorizationIdentificationResponse: JsonField<String>
                    ) = apply {
                        this.authorizationIdentificationResponse =
                            authorizationIdentificationResponse
                    }

                    /**
                     * A life-cycle identifier used across e.g., an authorization and a reversal.
                     * Expected to be unique per acquirer within a window of time. For some card
                     * networks the retrieval reference number includes the trace counter.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: String?) =
                        retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber))

                    /**
                     * Alias for calling [Builder.retrievalReferenceNumber] with
                     * `retrievalReferenceNumber.orElse(null)`.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: Optional<String>) =
                        retrievalReferenceNumber(retrievalReferenceNumber.getOrNull())

                    /**
                     * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.retrievalReferenceNumber] with a well-typed
                     * [String] value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField<String>) =
                        apply {
                            this.retrievalReferenceNumber = retrievalReferenceNumber
                        }

                    /**
                     * A counter used to verify an individual authorization. Expected to be unique
                     * per acquirer within a window of time.
                     */
                    fun traceNumber(traceNumber: String?) =
                        traceNumber(JsonField.ofNullable(traceNumber))

                    /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */
                    fun traceNumber(traceNumber: Optional<String>) =
                        traceNumber(traceNumber.getOrNull())

                    /**
                     * Sets [Builder.traceNumber] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.traceNumber] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun traceNumber(traceNumber: JsonField<String>) = apply {
                        this.traceNumber = traceNumber
                    }

                    /**
                     * A globally unique transaction identifier provided by the card network, used
                     * across multiple life-cycle requests.
                     */
                    fun transactionId(transactionId: String?) =
                        transactionId(JsonField.ofNullable(transactionId))

                    /**
                     * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`.
                     */
                    fun transactionId(transactionId: Optional<String>) =
                        transactionId(transactionId.getOrNull())

                    /**
                     * Sets [Builder.transactionId] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.transactionId] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun transactionId(transactionId: JsonField<String>) = apply {
                        this.transactionId = transactionId
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [NetworkIdentifiers].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .authorizationIdentificationResponse()
                     * .retrievalReferenceNumber()
                     * .traceNumber()
                     * .transactionId()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): NetworkIdentifiers =
                        NetworkIdentifiers(
                            checkRequired(
                                "authorizationIdentificationResponse",
                                authorizationIdentificationResponse,
                            ),
                            checkRequired("retrievalReferenceNumber", retrievalReferenceNumber),
                            checkRequired("traceNumber", traceNumber),
                            checkRequired("transactionId", transactionId),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): NetworkIdentifiers = apply {
                    if (validated) {
                        return@apply
                    }

                    authorizationIdentificationResponse()
                    retrievalReferenceNumber()
                    traceNumber()
                    transactionId()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) +
                        (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) +
                        (if (traceNumber.asKnown().isPresent) 1 else 0) +
                        (if (transactionId.asKnown().isPresent) 1 else 0)

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is NetworkIdentifiers &&
                        authorizationIdentificationResponse ==
                            other.authorizationIdentificationResponse &&
                        retrievalReferenceNumber == other.retrievalReferenceNumber &&
                        traceNumber == other.traceNumber &&
                        transactionId == other.transactionId &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        authorizationIdentificationResponse,
                        retrievalReferenceNumber,
                        traceNumber,
                        transactionId,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}"
            }

            class SchemeFee
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val amount: JsonField<String>,
                private val createdAt: JsonField<OffsetDateTime>,
                private val currency: JsonField<Currency>,
                private val feeType: JsonField<FeeType>,
                private val fixedComponent: JsonField<String>,
                private val variableRate: JsonField<String>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("amount")
                    @ExcludeMissing
                    amount: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("created_at")
                    @ExcludeMissing
                    createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                    @JsonProperty("currency")
                    @ExcludeMissing
                    currency: JsonField<Currency> = JsonMissing.of(),
                    @JsonProperty("fee_type")
                    @ExcludeMissing
                    feeType: JsonField<FeeType> = JsonMissing.of(),
                    @JsonProperty("fixed_component")
                    @ExcludeMissing
                    fixedComponent: JsonField<String> = JsonMissing.of(),
                    @JsonProperty("variable_rate")
                    @ExcludeMissing
                    variableRate: JsonField<String> = JsonMissing.of(),
                ) : this(
                    amount,
                    createdAt,
                    currency,
                    feeType,
                    fixedComponent,
                    variableRate,
                    mutableMapOf(),
                )

                /**
                 * The fee amount given as a string containing a decimal number.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun amount(): String = amount.getRequired("amount")

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was
                 * created.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /**
                 * The type of fee being assessed.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun feeType(): FeeType = feeType.getRequired("fee_type")

                /**
                 * The fixed component of the fee, if applicable, given in major units of the fee
                 * amount.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun fixedComponent(): Optional<String> =
                    fixedComponent.getOptional("fixed_component")

                /**
                 * The variable rate component of the fee, if applicable, given as a decimal (e.g.,
                 * 0.015 for 1.5%).
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun variableRate(): Optional<String> = variableRate.getOptional("variable_rate")

                /**
                 * Returns the raw JSON value of [amount].
                 *
                 * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField<String> = amount

                /**
                 * Returns the raw JSON value of [createdAt].
                 *
                 * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("created_at")
                @ExcludeMissing
                fun _createdAt(): JsonField<OffsetDateTime> = createdAt

                /**
                 * Returns the raw JSON value of [currency].
                 *
                 * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun _currency(): JsonField<Currency> = currency

                /**
                 * Returns the raw JSON value of [feeType].
                 *
                 * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("fee_type")
                @ExcludeMissing
                fun _feeType(): JsonField<FeeType> = feeType

                /**
                 * Returns the raw JSON value of [fixedComponent].
                 *
                 * Unlike [fixedComponent], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("fixed_component")
                @ExcludeMissing
                fun _fixedComponent(): JsonField<String> = fixedComponent

                /**
                 * Returns the raw JSON value of [variableRate].
                 *
                 * Unlike [variableRate], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("variable_rate")
                @ExcludeMissing
                fun _variableRate(): JsonField<String> = variableRate

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [SchemeFee].
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [SchemeFee]. */
                class Builder internal constructor() {

                    private var amount: JsonField<String>? = null
                    private var createdAt: JsonField<OffsetDateTime>? = null
                    private var currency: JsonField<Currency>? = null
                    private var feeType: JsonField<FeeType>? = null
                    private var fixedComponent: JsonField<String>? = null
                    private var variableRate: JsonField<String>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(schemeFee: SchemeFee) = apply {
                        amount = schemeFee.amount
                        createdAt = schemeFee.createdAt
                        currency = schemeFee.currency
                        feeType = schemeFee.feeType
                        fixedComponent = schemeFee.fixedComponent
                        variableRate = schemeFee.variableRate
                        additionalProperties = schemeFee.additionalProperties.toMutableMap()
                    }

                    /** The fee amount given as a string containing a decimal number. */
                    fun amount(amount: String) = amount(JsonField.of(amount))

                    /**
                     * Sets [Builder.amount] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.amount] with a well-typed [String] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun amount(amount: JsonField<String>) = apply { this.amount = amount }

                    /**
                     * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee
                     * was created.
                     */
                    fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt))

                    /**
                     * Sets [Builder.createdAt] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.createdAt] with a well-typed
                     * [OffsetDateTime] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply {
                        this.createdAt = createdAt
                    }

                    /**
                     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                     * reimbursement.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * Sets [Builder.currency] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.currency] with a well-typed [Currency] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun currency(currency: JsonField<Currency>) = apply { this.currency = currency }

                    /** The type of fee being assessed. */
                    fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType))

                    /**
                     * Sets [Builder.feeType] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.feeType] with a well-typed [FeeType] value
                     * instead. This method is primarily for setting the field to an undocumented or
                     * not yet supported value.
                     */
                    fun feeType(feeType: JsonField<FeeType>) = apply { this.feeType = feeType }

                    /**
                     * The fixed component of the fee, if applicable, given in major units of the
                     * fee amount.
                     */
                    fun fixedComponent(fixedComponent: String?) =
                        fixedComponent(JsonField.ofNullable(fixedComponent))

                    /**
                     * Alias for calling [Builder.fixedComponent] with
                     * `fixedComponent.orElse(null)`.
                     */
                    fun fixedComponent(fixedComponent: Optional<String>) =
                        fixedComponent(fixedComponent.getOrNull())

                    /**
                     * Sets [Builder.fixedComponent] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.fixedComponent] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun fixedComponent(fixedComponent: JsonField<String>) = apply {
                        this.fixedComponent = fixedComponent
                    }

                    /**
                     * The variable rate component of the fee, if applicable, given as a decimal
                     * (e.g., 0.015 for 1.5%).
                     */
                    fun variableRate(variableRate: String?) =
                        variableRate(JsonField.ofNullable(variableRate))

                    /**
                     * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`.
                     */
                    fun variableRate(variableRate: Optional<String>) =
                        variableRate(variableRate.getOrNull())

                    /**
                     * Sets [Builder.variableRate] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.variableRate] with a well-typed [String]
                     * value instead. This method is primarily for setting the field to an
                     * undocumented or not yet supported value.
                     */
                    fun variableRate(variableRate: JsonField<String>) = apply {
                        this.variableRate = variableRate
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [SchemeFee].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .amount()
                     * .createdAt()
                     * .currency()
                     * .feeType()
                     * .fixedComponent()
                     * .variableRate()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): SchemeFee =
                        SchemeFee(
                            checkRequired("amount", amount),
                            checkRequired("createdAt", createdAt),
                            checkRequired("currency", currency),
                            checkRequired("feeType", feeType),
                            checkRequired("fixedComponent", fixedComponent),
                            checkRequired("variableRate", variableRate),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): SchemeFee = apply {
                    if (validated) {
                        return@apply
                    }

                    amount()
                    createdAt()
                    currency().validate()
                    feeType().validate()
                    fixedComponent()
                    variableRate()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (if (amount.asKnown().isPresent) 1 else 0) +
                        (if (createdAt.asKnown().isPresent) 1 else 0) +
                        (currency.asKnown().getOrNull()?.validity() ?: 0) +
                        (feeType.asKnown().getOrNull()?.validity() ?: 0) +
                        (if (fixedComponent.asKnown().isPresent) 1 else 0) +
                        (if (variableRate.asKnown().isPresent) 1 else 0)

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee
                 * reimbursement.
                 */
                class Currency
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /** US Dollar (USD) */
                        @JvmField val USD = of("USD")

                        @JvmStatic fun of(value: String) = Currency(JsonField.of(value))
                    }

                    /** An enum containing [Currency]'s known values. */
                    enum class Known {
                        /** US Dollar (USD) */
                        USD
                    }

                    /**
                     * An enum containing [Currency]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [Currency] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /** US Dollar (USD) */
                        USD,
                        /**
                         * An enum member indicating that [Currency] was instantiated with an
                         * unknown value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            USD -> Value.USD
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            USD -> Known.USD
                            else -> throw IncreaseInvalidDataException("Unknown Currency: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): Currency = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is Currency && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                /** The type of fee being assessed. */
                class FeeType
                @JsonCreator
                private constructor(private val value: JsonField<String>) : Enum {

                    /**
                     * Returns this class instance's raw value.
                     *
                     * This is usually only useful if this instance was deserialized from data that
                     * doesn't match any known member, and you want to know that value. For example,
                     * if the SDK is on an older version than the API, then the API may respond with
                     * new members that the SDK is unaware of.
                     */
                    @com.fasterxml.jackson.annotation.JsonValue
                    fun _value(): JsonField<String> = value

                    companion object {

                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY =
                            of("visa_international_service_assessment_single_currency")

                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        @JvmField
                        val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY =
                            of("visa_international_service_assessment_cross_currency")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE =
                            of("visa_authorization_domestic_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_international_point_of_sale")

                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE =
                            of("visa_authorization_canada_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_point_of_sale")

                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE =
                            of("visa_authorization_reversal_international_point_of_sale")

                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        @JvmField
                        val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE =
                            of("visa_authorization_address_verification_service")

                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        @JvmField
                        val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization")

                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission")

                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_DOMESTIC =
                            of("visa_account_verification_domestic")

                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL =
                            of("visa_account_verification_international")

                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        @JvmField
                        val VISA_ACCOUNT_VERIFICATION_CANADA =
                            of("visa_account_verification_canada")

                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee")

                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        @JvmField
                        val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE =
                            of("visa_consumer_debit_acceptance_fee")

                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        @JvmField
                        val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE =
                            of("visa_business_debit_acceptance_fee")

                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        @JvmField
                        val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee")

                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic")

                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        @JvmField
                        val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international")

                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token")

                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token")

                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission")

                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization")

                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        @JvmField
                        val VISA_DIRECT_TRANSACTION_DOMESTIC =
                            of("visa_direct_transaction_domestic")

                        /** Issuer card service fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit")

                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        @JvmField
                        val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT =
                            of("visa_advertising_service_commercial_credit")

                        /** Issuer Community Growth Acceleration Program Fee. */
                        @JvmField
                        val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM =
                            of("visa_community_growth_acceleration_program")

                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        @JvmField
                        val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT =
                            of("visa_processing_guarantee_commercial_credit")

                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee")

                        @JvmStatic fun of(value: String) = FeeType(JsonField.of(value))
                    }

                    /** An enum containing [FeeType]'s known values. */
                    enum class Known {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                    }

                    /**
                     * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member.
                     *
                     * An instance of [FeeType] can contain an unknown value in a couple of cases:
                     * - It was deserialized from data that doesn't match any known member. For
                     *   example, if the SDK is on an older version than the API, then the API may
                     *   respond with new members that the SDK is unaware of.
                     * - It was constructed with an arbitrary value using the [of] method.
                     */
                    enum class Value {
                        /**
                         * International Service Assessment (ISA) single-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in the same currency.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY,
                        /**
                         * International Service Assessment (ISA) cross-currency is a fee assessed
                         * by the card network for cross-border transactions presented and settled
                         * in different currencies.
                         */
                        VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) authorization transactions. Authorization is the process
                         * of approving or declining the transaction amount specified. The fee is
                         * assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for POS
                         * (Point-Of-Sale) International authorization transactions. Authorization
                         * is the process of approving or declining the transaction amount
                         * specified. The fee is assessed to the Issuer.
                         */
                        VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * Activity and charges for Visa Settlement System processing for Canada
                         * Region POS (Point-of-Sale) authorization transactions. Authorization is
                         * the process of approving or declining the transaction amount specified.
                         */
                        VISA_AUTHORIZATION_CANADA_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) reversal transactions. Authorization reversal represents
                         * a VSS message that undoes the complete or partial actions of a previous
                         * authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE,
                        /**
                         * Activity only for Visa Settlement System authorization processing of POS
                         * (Point-Of-Sale) International reversal transactions. Authorization
                         * reversal represents a VSS message that undoes the complete or partial
                         * actions of a previous authorization request.
                         */
                        VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE,
                        /**
                         * A per Address Verification Service (AVS) result fee. Applies to all
                         * usable AVS result codes.
                         */
                        VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE,
                        /**
                         * Advanced Authorization is a fraud detection tool that monitors and risk
                         * evaluates 100 percent of US VisaNet authorizations in real-time. Activity
                         * related to Purchase (includes Signature Authenticated Visa and PIN
                         * Authenticated Visa Debit (PAVD) transactions).
                         */
                        VISA_ADVANCED_AUTHORIZATION,
                        /**
                         * Issuer Transactions Visa represents a charge based on total actual
                         * monthly processing (Visa transactions only) through a VisaNet Access
                         * Point (VAP). Charges are assessed to the processor for each VisaNet
                         * Access Point.
                         */
                        VISA_MESSAGE_TRANSMISSION,
                        /**
                         * Activity, per inquiry, related to the domestic Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_DOMESTIC,
                        /**
                         * Activity, per inquiry, related to the international Issuer for Account
                         * Number Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_INTERNATIONAL,
                        /**
                         * Activity, per inquiry, related to the US-Canada Issuer for Account Number
                         * Verification.
                         */
                        VISA_ACCOUNT_VERIFICATION_CANADA,
                        /**
                         * The Corporate Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Commercial and Government Debit, Prepaid, Credit,
                         * Charge, or Deferred Debit card transactions.
                         */
                        VISA_CORPORATE_ACCEPTANCE_FEE,
                        /**
                         * The Consumer Debit Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume of Consumer Debit or Prepaid card transactions.
                         * The cashback portion of a Debit and Prepaid card transaction is excluded
                         * from the sales volume calculation.
                         */
                        VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Business Acceptance Fee is charged to issuers and is based on the
                         * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or
                         * Deferred Debit card transactions. The cashback portion is included in the
                         * sales volume calculation with the exception of a Debit and Prepaid card
                         * transactions.
                         */
                        VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE,
                        /**
                         * The Purchasing Card Acceptance Fee is charged to issuers and is based on
                         * the monthly sales volume on Commercial and Government Debit, Prepaid,
                         * Credit, Charge, or Deferred Debit card transactions.
                         */
                        VISA_PURCHASING_ACCEPTANCE_FEE,
                        /**
                         * Activity and fees for the processing of a sales draft original for a
                         * purchase transaction.
                         */
                        VISA_PURCHASE_DOMESTIC,
                        /**
                         * Activity and fees for the processing of an international sales draft
                         * original for a purchase transaction.
                         */
                        VISA_PURCHASE_INTERNATIONAL,
                        /**
                         * Apple Pay Credit Product Token Purchase Original Transactions. This fee
                         * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_CREDIT_PURCHASE_TOKEN,
                        /**
                         * Apple Pay Debit Product Token Purchase Original Transactions. This fee is
                         * billed by Visa on behalf of Apple Inc. for Apple Pay transactions.
                         */
                        VISA_DEBIT_PURCHASE_TOKEN,
                        /** A per transaction fee assessed for Base II financial draft - Issuer. */
                        VISA_CLEARING_TRANSMISSION,
                        /**
                         * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined
                         * Financial OCT/AFT 0200 transactions.
                         */
                        VISA_DIRECT_AUTHORIZATION,
                        /**
                         * Data processing charge for Visa Direct OCTs for all business application
                         * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II
                         * transactions.
                         */
                        VISA_DIRECT_TRANSACTION_DOMESTIC,
                        /** Issuer card service fee for Commercial Credit cards. */
                        VISA_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Advertising Service Fee for Commercial Credit cards. */
                        VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT,
                        /** Issuer Community Growth Acceleration Program Fee. */
                        VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM,
                        /** Issuer Processing Guarantee for Commercial Credit cards. */
                        VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT,
                        /**
                         * Pulse Switch Fee is a fee charged by the Pulse network for processing
                         * transactions on its network.
                         */
                        PULSE_SWITCH_FEE,
                        /**
                         * An enum member indicating that [FeeType] was instantiated with an unknown
                         * value.
                         */
                        _UNKNOWN,
                    }

                    /**
                     * Returns an enum member corresponding to this class instance's value, or
                     * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                     *
                     * Use the [known] method instead if you're certain the value is always known or
                     * if you want to throw for the unknown case.
                     */
                    fun value(): Value =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Value.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Value.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE
                            else -> Value._UNKNOWN
                        }

                    /**
                     * Returns an enum member corresponding to this class instance's value.
                     *
                     * Use the [value] method instead if you're uncertain the value is always known
                     * and don't want to throw for the unknown case.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value is a not
                     *   a known member.
                     */
                    fun known(): Known =
                        when (this) {
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY
                            VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY ->
                                Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY
                            VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE
                            VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_CANADA_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE ->
                                Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE
                            VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE ->
                                Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE
                            VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION
                            VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION
                            VISA_ACCOUNT_VERIFICATION_DOMESTIC ->
                                Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC
                            VISA_ACCOUNT_VERIFICATION_INTERNATIONAL ->
                                Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL
                            VISA_ACCOUNT_VERIFICATION_CANADA ->
                                Known.VISA_ACCOUNT_VERIFICATION_CANADA
                            VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE
                            VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE
                            VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE ->
                                Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE
                            VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE
                            VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC
                            VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL
                            VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN
                            VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN
                            VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION
                            VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION
                            VISA_DIRECT_TRANSACTION_DOMESTIC ->
                                Known.VISA_DIRECT_TRANSACTION_DOMESTIC
                            VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT
                            VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT ->
                                Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT
                            VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM ->
                                Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM
                            VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT ->
                                Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT
                            PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE
                            else -> throw IncreaseInvalidDataException("Unknown FeeType: $value")
                        }

                    /**
                     * Returns this class instance's primitive wire representation.
                     *
                     * This differs from the [toString] method because that method is primarily for
                     * debugging and generally doesn't throw.
                     *
                     * @throws IncreaseInvalidDataException if this class instance's value does not
                     *   have the expected primitive type.
                     */
                    fun asString(): String =
                        _value().asString().orElseThrow {
                            IncreaseInvalidDataException("Value is not a String")
                        }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): FeeType = apply {
                        if (validated) {
                            return@apply
                        }

                        known()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is FeeType && value == other.value
                    }

                    override fun hashCode() = value.hashCode()

                    override fun toString() = value.toString()
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is SchemeFee &&
                        amount == other.amount &&
                        createdAt == other.createdAt &&
                        currency == other.currency &&
                        feeType == other.feeType &&
                        fixedComponent == other.fixedComponent &&
                        variableRate == other.variableRate &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        amount,
                        createdAt,
                        currency,
                        feeType,
                        fixedComponent,
                        variableRate,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}"
            }

            /**
             * A constant representing the object's type. For this resource it will always be
             * `inbound_card_validation`.
             */
            class Type @JsonCreator private constructor(private val value: JsonField<String>) :
                Enum {

                /**
                 * Returns this class instance's raw value.
                 *
                 * This is usually only useful if this instance was deserialized from data that
                 * doesn't match any known member, and you want to know that value. For example, if
                 * the SDK is on an older version than the API, then the API may respond with new
                 * members that the SDK is unaware of.
                 */
                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

                companion object {

                    @JvmField val INBOUND_CARD_VALIDATION = of("inbound_card_validation")

                    @JvmStatic fun of(value: String) = Type(JsonField.of(value))
                }

                /** An enum containing [Type]'s known values. */
                enum class Known {
                    INBOUND_CARD_VALIDATION
                }

                /**
                 * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
                 *
                 * An instance of [Type] can contain an unknown value in a couple of cases:
                 * - It was deserialized from data that doesn't match any known member. For example,
                 *   if the SDK is on an older version than the API, then the API may respond with
                 *   new members that the SDK is unaware of.
                 * - It was constructed with an arbitrary value using the [of] method.
                 */
                enum class Value {
                    INBOUND_CARD_VALIDATION,
                    /**
                     * An enum member indicating that [Type] was instantiated with an unknown value.
                     */
                    _UNKNOWN,
                }

                /**
                 * Returns an enum member corresponding to this class instance's value, or
                 * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                 *
                 * Use the [known] method instead if you're certain the value is always known or if
                 * you want to throw for the unknown case.
                 */
                fun value(): Value =
                    when (this) {
                        INBOUND_CARD_VALIDATION -> Value.INBOUND_CARD_VALIDATION
                        else -> Value._UNKNOWN
                    }

                /**
                 * Returns an enum member corresponding to this class instance's value.
                 *
                 * Use the [value] method instead if you're uncertain the value is always known and
                 * don't want to throw for the unknown case.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value is a not a
                 *   known member.
                 */
                fun known(): Known =
                    when (this) {
                        INBOUND_CARD_VALIDATION -> Known.INBOUND_CARD_VALIDATION
                        else -> throw IncreaseInvalidDataException("Unknown Type: $value")
                    }

                /**
                 * Returns this class instance's primitive wire representation.
                 *
                 * This differs from the [toString] method because that method is primarily for
                 * debugging and generally doesn't throw.
                 *
                 * @throws IncreaseInvalidDataException if this class instance's value does not have
                 *   the expected primitive type.
                 */
                fun asString(): String =
                    _value().asString().orElseThrow {
                        IncreaseInvalidDataException("Value is not a String")
                    }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Type = apply {
                    if (validated) {
                        return@apply
                    }

                    known()
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Type && value == other.value
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()
            }

            /** Fields related to verification of cardholder-provided values. */
            class Verification
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val cardVerificationCode: JsonField<CardVerificationCode>,
                private val cardholderAddress: JsonField<CardholderAddress>,
                private val cardholderName: JsonField<CardholderName>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("card_verification_code")
                    @ExcludeMissing
                    cardVerificationCode: JsonField<CardVerificationCode> = JsonMissing.of(),
                    @JsonProperty("cardholder_address")
                    @ExcludeMissing
                    cardholderAddress: JsonField<CardholderAddress> = JsonMissing.of(),
                    @JsonProperty("cardholder_name")
                    @ExcludeMissing
                    cardholderName: JsonField<CardholderName> = JsonMissing.of(),
                ) : this(cardVerificationCode, cardholderAddress, cardholderName, mutableMapOf())

                /**
                 * Fields related to verification of the Card Verification Code, a 3-digit code on
                 * the back of the card.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun cardVerificationCode(): CardVerificationCode =
                    cardVerificationCode.getRequired("card_verification_code")

                /**
                 * Cardholder address provided in the authorization request and the address on file
                 * we verified it against.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun cardholderAddress(): CardholderAddress =
                    cardholderAddress.getRequired("cardholder_address")

                /**
                 * Cardholder name provided in the authorization request.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun cardholderName(): Optional<CardholderName> =
                    cardholderName.getOptional("cardholder_name")

                /**
                 * Returns the raw JSON value of [cardVerificationCode].
                 *
                 * Unlike [cardVerificationCode], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("card_verification_code")
                @ExcludeMissing
                fun _cardVerificationCode(): JsonField<CardVerificationCode> = cardVerificationCode

                /**
                 * Returns the raw JSON value of [cardholderAddress].
                 *
                 * Unlike [cardholderAddress], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("cardholder_address")
                @ExcludeMissing
                fun _cardholderAddress(): JsonField<CardholderAddress> = cardholderAddress

                /**
                 * Returns the raw JSON value of [cardholderName].
                 *
                 * Unlike [cardholderName], this method doesn't throw if the JSON field has an
                 * unexpected type.
                 */
                @JsonProperty("cardholder_name")
                @ExcludeMissing
                fun _cardholderName(): JsonField<CardholderName> = cardholderName

                @JsonAnySetter
                private fun putAdditionalProperty(key: String, value: JsonValue) {
                    additionalProperties.put(key, value)
                }

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map<String, JsonValue> =
                    Collections.unmodifiableMap(additionalProperties)

                fun toBuilder() = Builder().from(this)

                companion object {

                    /**
                     * Returns a mutable builder for constructing an instance of [Verification].
                     *
                     * The following fields are required:
                     * ```java
                     * .cardVerificationCode()
                     * .cardholderAddress()
                     * .cardholderName()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

                /** A builder for [Verification]. */
                class Builder internal constructor() {

                    private var cardVerificationCode: JsonField<CardVerificationCode>? = null
                    private var cardholderAddress: JsonField<CardholderAddress>? = null
                    private var cardholderName: JsonField<CardholderName>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(verification: Verification) = apply {
                        cardVerificationCode = verification.cardVerificationCode
                        cardholderAddress = verification.cardholderAddress
                        cardholderName = verification.cardholderName
                        additionalProperties = verification.additionalProperties.toMutableMap()
                    }

                    /**
                     * Fields related to verification of the Card Verification Code, a 3-digit code
                     * on the back of the card.
                     */
                    fun cardVerificationCode(cardVerificationCode: CardVerificationCode) =
                        cardVerificationCode(JsonField.of(cardVerificationCode))

                    /**
                     * Sets [Builder.cardVerificationCode] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.cardVerificationCode] with a well-typed
                     * [CardVerificationCode] value instead. This method is primarily for setting
                     * the field to an undocumented or not yet supported value.
                     */
                    fun cardVerificationCode(
                        cardVerificationCode: JsonField<CardVerificationCode>
                    ) = apply { this.cardVerificationCode = cardVerificationCode }

                    /**
                     * Cardholder address provided in the authorization request and the address on
                     * file we verified it against.
                     */
                    fun cardholderAddress(cardholderAddress: CardholderAddress) =
                        cardholderAddress(JsonField.of(cardholderAddress))

                    /**
                     * Sets [Builder.cardholderAddress] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.cardholderAddress] with a well-typed
                     * [CardholderAddress] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun cardholderAddress(cardholderAddress: JsonField<CardholderAddress>) = apply {
                        this.cardholderAddress = cardholderAddress
                    }

                    /** Cardholder name provided in the authorization request. */
                    fun cardholderName(cardholderName: CardholderName?) =
                        cardholderName(JsonField.ofNullable(cardholderName))

                    /**
                     * Alias for calling [Builder.cardholderName] with
                     * `cardholderName.orElse(null)`.
                     */
                    fun cardholderName(cardholderName: Optional<CardholderName>) =
                        cardholderName(cardholderName.getOrNull())

                    /**
                     * Sets [Builder.cardholderName] to an arbitrary JSON value.
                     *
                     * You should usually call [Builder.cardholderName] with a well-typed
                     * [CardholderName] value instead. This method is primarily for setting the
                     * field to an undocumented or not yet supported value.
                     */
                    fun cardholderName(cardholderName: JsonField<CardholderName>) = apply {
                        this.cardholderName = cardholderName
                    }

                    fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                        this.additionalProperties.clear()
                        putAllAdditionalProperties(additionalProperties)
                    }

                    fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                        additionalProperties.put(key, value)
                    }

                    fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun removeAdditionalProperty(key: String) = apply {
                        additionalProperties.remove(key)
                    }

                    fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                        keys.forEach(::removeAdditionalProperty)
                    }

                    /**
                     * Returns an immutable instance of [Verification].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .cardVerificationCode()
                     * .cardholderAddress()
                     * .cardholderName()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): Verification =
                        Verification(
                            checkRequired("cardVerificationCode", cardVerificationCode),
                            checkRequired("cardholderAddress", cardholderAddress),
                            checkRequired("cardholderName", cardholderName),
                            additionalProperties.toMutableMap(),
                        )
                }

                private var validated: Boolean = false

                /**
                 * Validates that the types of all values in this object match their expected types
                 * recursively.
                 *
                 * This method is _not_ forwards compatible with new types from the API for existing
                 * fields.
                 *
                 * @throws IncreaseInvalidDataException if any value type in this object doesn't
                 *   match its expected type.
                 */
                fun validate(): Verification = apply {
                    if (validated) {
                        return@apply
                    }

                    cardVerificationCode().validate()
                    cardholderAddress().validate()
                    cardholderName().ifPresent { it.validate() }
                    validated = true
                }

                fun isValid(): Boolean =
                    try {
                        validate()
                        true
                    } catch (e: IncreaseInvalidDataException) {
                        false
                    }

                /**
                 * Returns a score indicating how many valid values are contained in this object
                 * recursively.
                 *
                 * Used for best match union deserialization.
                 */
                @JvmSynthetic
                internal fun validity(): Int =
                    (cardVerificationCode.asKnown().getOrNull()?.validity() ?: 0) +
                        (cardholderAddress.asKnown().getOrNull()?.validity() ?: 0) +
                        (cardholderName.asKnown().getOrNull()?.validity() ?: 0)

                /**
                 * Fields related to verification of the Card Verification Code, a 3-digit code on
                 * the back of the card.
                 */
                class CardVerificationCode
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val result: JsonField<Result>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("result")
                        @ExcludeMissing
                        result: JsonField<Result> = JsonMissing.of()
                    ) : this(result, mutableMapOf())

                    /**
                     * The result of verifying the Card Verification Code.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun result(): Result = result.getRequired("result")

                    /**
                     * Returns the raw JSON value of [result].
                     *
                     * Unlike [result], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("result")
                    @ExcludeMissing
                    fun _result(): JsonField<Result> = result

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [CardVerificationCode].
                         *
                         * The following fields are required:
                         * ```java
                         * .result()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CardVerificationCode]. */
                    class Builder internal constructor() {

                        private var result: JsonField<Result>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(cardVerificationCode: CardVerificationCode) = apply {
                            result = cardVerificationCode.result
                            additionalProperties =
                                cardVerificationCode.additionalProperties.toMutableMap()
                        }

                        /** The result of verifying the Card Verification Code. */
                        fun result(result: Result) = result(JsonField.of(result))

                        /**
                         * Sets [Builder.result] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.result] with a well-typed [Result] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun result(result: JsonField<Result>) = apply { this.result = result }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CardVerificationCode].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .result()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CardVerificationCode =
                            CardVerificationCode(
                                checkRequired("result", result),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CardVerificationCode = apply {
                        if (validated) {
                            return@apply
                        }

                        result().validate()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0)

                    /** The result of verifying the Card Verification Code. */
                    class Result
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /**
                             * No card verification code was provided in the authorization request.
                             */
                            @JvmField val NOT_CHECKED = of("not_checked")

                            /** The card verification code matched the one on file. */
                            @JvmField val MATCH = of("match")

                            /** The card verification code did not match the one on file. */
                            @JvmField val NO_MATCH = of("no_match")

                            @JvmStatic fun of(value: String) = Result(JsonField.of(value))
                        }

                        /** An enum containing [Result]'s known values. */
                        enum class Known {
                            /**
                             * No card verification code was provided in the authorization request.
                             */
                            NOT_CHECKED,
                            /** The card verification code matched the one on file. */
                            MATCH,
                            /** The card verification code did not match the one on file. */
                            NO_MATCH,
                        }

                        /**
                         * An enum containing [Result]'s known values, as well as an [_UNKNOWN]
                         * member.
                         *
                         * An instance of [Result] can contain an unknown value in a couple of
                         * cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /**
                             * No card verification code was provided in the authorization request.
                             */
                            NOT_CHECKED,
                            /** The card verification code matched the one on file. */
                            MATCH,
                            /** The card verification code did not match the one on file. */
                            NO_MATCH,
                            /**
                             * An enum member indicating that [Result] was instantiated with an
                             * unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NOT_CHECKED -> Value.NOT_CHECKED
                                MATCH -> Value.MATCH
                                NO_MATCH -> Value.NO_MATCH
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NOT_CHECKED -> Known.NOT_CHECKED
                                MATCH -> Known.MATCH
                                NO_MATCH -> Known.NO_MATCH
                                else -> throw IncreaseInvalidDataException("Unknown Result: $value")
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): Result = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is Result && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CardVerificationCode &&
                            result == other.result &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}"
                }

                /**
                 * Cardholder address provided in the authorization request and the address on file
                 * we verified it against.
                 */
                class CardholderAddress
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val actualLine1: JsonField<String>,
                    private val actualPostalCode: JsonField<String>,
                    private val providedLine1: JsonField<String>,
                    private val providedPostalCode: JsonField<String>,
                    private val result: JsonField<Result>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("actual_line1")
                        @ExcludeMissing
                        actualLine1: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("actual_postal_code")
                        @ExcludeMissing
                        actualPostalCode: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_line1")
                        @ExcludeMissing
                        providedLine1: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_postal_code")
                        @ExcludeMissing
                        providedPostalCode: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("result")
                        @ExcludeMissing
                        result: JsonField<Result> = JsonMissing.of(),
                    ) : this(
                        actualLine1,
                        actualPostalCode,
                        providedLine1,
                        providedPostalCode,
                        result,
                        mutableMapOf(),
                    )

                    /**
                     * Line 1 of the address on file for the cardholder.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun actualLine1(): Optional<String> = actualLine1.getOptional("actual_line1")

                    /**
                     * The postal code of the address on file for the cardholder.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun actualPostalCode(): Optional<String> =
                        actualPostalCode.getOptional("actual_postal_code")

                    /**
                     * The cardholder address line 1 provided for verification in the authorization
                     * request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedLine1(): Optional<String> =
                        providedLine1.getOptional("provided_line1")

                    /**
                     * The postal code provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedPostalCode(): Optional<String> =
                        providedPostalCode.getOptional("provided_postal_code")

                    /**
                     * The address verification result returned to the card network.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun result(): Result = result.getRequired("result")

                    /**
                     * Returns the raw JSON value of [actualLine1].
                     *
                     * Unlike [actualLine1], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("actual_line1")
                    @ExcludeMissing
                    fun _actualLine1(): JsonField<String> = actualLine1

                    /**
                     * Returns the raw JSON value of [actualPostalCode].
                     *
                     * Unlike [actualPostalCode], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("actual_postal_code")
                    @ExcludeMissing
                    fun _actualPostalCode(): JsonField<String> = actualPostalCode

                    /**
                     * Returns the raw JSON value of [providedLine1].
                     *
                     * Unlike [providedLine1], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("provided_line1")
                    @ExcludeMissing
                    fun _providedLine1(): JsonField<String> = providedLine1

                    /**
                     * Returns the raw JSON value of [providedPostalCode].
                     *
                     * Unlike [providedPostalCode], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("provided_postal_code")
                    @ExcludeMissing
                    fun _providedPostalCode(): JsonField<String> = providedPostalCode

                    /**
                     * Returns the raw JSON value of [result].
                     *
                     * Unlike [result], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("result")
                    @ExcludeMissing
                    fun _result(): JsonField<Result> = result

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [CardholderAddress].
                         *
                         * The following fields are required:
                         * ```java
                         * .actualLine1()
                         * .actualPostalCode()
                         * .providedLine1()
                         * .providedPostalCode()
                         * .result()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CardholderAddress]. */
                    class Builder internal constructor() {

                        private var actualLine1: JsonField<String>? = null
                        private var actualPostalCode: JsonField<String>? = null
                        private var providedLine1: JsonField<String>? = null
                        private var providedPostalCode: JsonField<String>? = null
                        private var result: JsonField<Result>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(cardholderAddress: CardholderAddress) = apply {
                            actualLine1 = cardholderAddress.actualLine1
                            actualPostalCode = cardholderAddress.actualPostalCode
                            providedLine1 = cardholderAddress.providedLine1
                            providedPostalCode = cardholderAddress.providedPostalCode
                            result = cardholderAddress.result
                            additionalProperties =
                                cardholderAddress.additionalProperties.toMutableMap()
                        }

                        /** Line 1 of the address on file for the cardholder. */
                        fun actualLine1(actualLine1: String?) =
                            actualLine1(JsonField.ofNullable(actualLine1))

                        /**
                         * Alias for calling [Builder.actualLine1] with `actualLine1.orElse(null)`.
                         */
                        fun actualLine1(actualLine1: Optional<String>) =
                            actualLine1(actualLine1.getOrNull())

                        /**
                         * Sets [Builder.actualLine1] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.actualLine1] with a well-typed [String]
                         * value instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun actualLine1(actualLine1: JsonField<String>) = apply {
                            this.actualLine1 = actualLine1
                        }

                        /** The postal code of the address on file for the cardholder. */
                        fun actualPostalCode(actualPostalCode: String?) =
                            actualPostalCode(JsonField.ofNullable(actualPostalCode))

                        /**
                         * Alias for calling [Builder.actualPostalCode] with
                         * `actualPostalCode.orElse(null)`.
                         */
                        fun actualPostalCode(actualPostalCode: Optional<String>) =
                            actualPostalCode(actualPostalCode.getOrNull())

                        /**
                         * Sets [Builder.actualPostalCode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.actualPostalCode] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun actualPostalCode(actualPostalCode: JsonField<String>) = apply {
                            this.actualPostalCode = actualPostalCode
                        }

                        /**
                         * The cardholder address line 1 provided for verification in the
                         * authorization request.
                         */
                        fun providedLine1(providedLine1: String?) =
                            providedLine1(JsonField.ofNullable(providedLine1))

                        /**
                         * Alias for calling [Builder.providedLine1] with
                         * `providedLine1.orElse(null)`.
                         */
                        fun providedLine1(providedLine1: Optional<String>) =
                            providedLine1(providedLine1.getOrNull())

                        /**
                         * Sets [Builder.providedLine1] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedLine1] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedLine1(providedLine1: JsonField<String>) = apply {
                            this.providedLine1 = providedLine1
                        }

                        /**
                         * The postal code provided for verification in the authorization request.
                         */
                        fun providedPostalCode(providedPostalCode: String?) =
                            providedPostalCode(JsonField.ofNullable(providedPostalCode))

                        /**
                         * Alias for calling [Builder.providedPostalCode] with
                         * `providedPostalCode.orElse(null)`.
                         */
                        fun providedPostalCode(providedPostalCode: Optional<String>) =
                            providedPostalCode(providedPostalCode.getOrNull())

                        /**
                         * Sets [Builder.providedPostalCode] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedPostalCode] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedPostalCode(providedPostalCode: JsonField<String>) = apply {
                            this.providedPostalCode = providedPostalCode
                        }

                        /** The address verification result returned to the card network. */
                        fun result(result: Result) = result(JsonField.of(result))

                        /**
                         * Sets [Builder.result] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.result] with a well-typed [Result] value
                         * instead. This method is primarily for setting the field to an
                         * undocumented or not yet supported value.
                         */
                        fun result(result: JsonField<Result>) = apply { this.result = result }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CardholderAddress].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .actualLine1()
                         * .actualPostalCode()
                         * .providedLine1()
                         * .providedPostalCode()
                         * .result()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CardholderAddress =
                            CardholderAddress(
                                checkRequired("actualLine1", actualLine1),
                                checkRequired("actualPostalCode", actualPostalCode),
                                checkRequired("providedLine1", providedLine1),
                                checkRequired("providedPostalCode", providedPostalCode),
                                checkRequired("result", result),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CardholderAddress = apply {
                        if (validated) {
                            return@apply
                        }

                        actualLine1()
                        actualPostalCode()
                        providedLine1()
                        providedPostalCode()
                        result().validate()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (actualLine1.asKnown().isPresent) 1 else 0) +
                            (if (actualPostalCode.asKnown().isPresent) 1 else 0) +
                            (if (providedLine1.asKnown().isPresent) 1 else 0) +
                            (if (providedPostalCode.asKnown().isPresent) 1 else 0) +
                            (result.asKnown().getOrNull()?.validity() ?: 0)

                    /** The address verification result returned to the card network. */
                    class Result
                    @JsonCreator
                    private constructor(private val value: JsonField<String>) : Enum {

                        /**
                         * Returns this class instance's raw value.
                         *
                         * This is usually only useful if this instance was deserialized from data
                         * that doesn't match any known member, and you want to know that value. For
                         * example, if the SDK is on an older version than the API, then the API may
                         * respond with new members that the SDK is unaware of.
                         */
                        @com.fasterxml.jackson.annotation.JsonValue
                        fun _value(): JsonField<String> = value

                        companion object {

                            /** No address information was provided in the authorization request. */
                            @JvmField val NOT_CHECKED = of("not_checked")

                            /**
                             * Postal code matches, but the street address does not match or was not
                             * provided.
                             */
                            @JvmField
                            val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH =
                                of("postal_code_match_address_no_match")

                            /**
                             * Postal code does not match, but the street address matches or was not
                             * provided.
                             */
                            @JvmField
                            val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH =
                                of("postal_code_no_match_address_match")

                            /** Postal code and street address match. */
                            @JvmField val MATCH = of("match")

                            /** Postal code and street address do not match. */
                            @JvmField val NO_MATCH = of("no_match")

                            /**
                             * Postal code matches, but the street address was not verified.
                             * (deprecated)
                             */
                            @JvmField
                            val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED =
                                of("postal_code_match_address_not_checked")

                            @JvmStatic fun of(value: String) = Result(JsonField.of(value))
                        }

                        /** An enum containing [Result]'s known values. */
                        enum class Known {
                            /** No address information was provided in the authorization request. */
                            NOT_CHECKED,
                            /**
                             * Postal code matches, but the street address does not match or was not
                             * provided.
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NO_MATCH,
                            /**
                             * Postal code does not match, but the street address matches or was not
                             * provided.
                             */
                            POSTAL_CODE_NO_MATCH_ADDRESS_MATCH,
                            /** Postal code and street address match. */
                            MATCH,
                            /** Postal code and street address do not match. */
                            NO_MATCH,
                            /**
                             * Postal code matches, but the street address was not verified.
                             * (deprecated)
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED,
                        }

                        /**
                         * An enum containing [Result]'s known values, as well as an [_UNKNOWN]
                         * member.
                         *
                         * An instance of [Result] can contain an unknown value in a couple of
                         * cases:
                         * - It was deserialized from data that doesn't match any known member. For
                         *   example, if the SDK is on an older version than the API, then the API
                         *   may respond with new members that the SDK is unaware of.
                         * - It was constructed with an arbitrary value using the [of] method.
                         */
                        enum class Value {
                            /** No address information was provided in the authorization request. */
                            NOT_CHECKED,
                            /**
                             * Postal code matches, but the street address does not match or was not
                             * provided.
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NO_MATCH,
                            /**
                             * Postal code does not match, but the street address matches or was not
                             * provided.
                             */
                            POSTAL_CODE_NO_MATCH_ADDRESS_MATCH,
                            /** Postal code and street address match. */
                            MATCH,
                            /** Postal code and street address do not match. */
                            NO_MATCH,
                            /**
                             * Postal code matches, but the street address was not verified.
                             * (deprecated)
                             */
                            POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED,
                            /**
                             * An enum member indicating that [Result] was instantiated with an
                             * unknown value.
                             */
                            _UNKNOWN,
                        }

                        /**
                         * Returns an enum member corresponding to this class instance's value, or
                         * [Value._UNKNOWN] if the class was instantiated with an unknown value.
                         *
                         * Use the [known] method instead if you're certain the value is always
                         * known or if you want to throw for the unknown case.
                         */
                        fun value(): Value =
                            when (this) {
                                NOT_CHECKED -> Value.NOT_CHECKED
                                POSTAL_CODE_MATCH_ADDRESS_NO_MATCH ->
                                    Value.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH
                                POSTAL_CODE_NO_MATCH_ADDRESS_MATCH ->
                                    Value.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH
                                MATCH -> Value.MATCH
                                NO_MATCH -> Value.NO_MATCH
                                POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED ->
                                    Value.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED
                                else -> Value._UNKNOWN
                            }

                        /**
                         * Returns an enum member corresponding to this class instance's value.
                         *
                         * Use the [value] method instead if you're uncertain the value is always
                         * known and don't want to throw for the unknown case.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value is a
                         *   not a known member.
                         */
                        fun known(): Known =
                            when (this) {
                                NOT_CHECKED -> Known.NOT_CHECKED
                                POSTAL_CODE_MATCH_ADDRESS_NO_MATCH ->
                                    Known.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH
                                POSTAL_CODE_NO_MATCH_ADDRESS_MATCH ->
                                    Known.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH
                                MATCH -> Known.MATCH
                                NO_MATCH -> Known.NO_MATCH
                                POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED ->
                                    Known.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED
                                else -> throw IncreaseInvalidDataException("Unknown Result: $value")
                            }

                        /**
                         * Returns this class instance's primitive wire representation.
                         *
                         * This differs from the [toString] method because that method is primarily
                         * for debugging and generally doesn't throw.
                         *
                         * @throws IncreaseInvalidDataException if this class instance's value does
                         *   not have the expected primitive type.
                         */
                        fun asString(): String =
                            _value().asString().orElseThrow {
                                IncreaseInvalidDataException("Value is not a String")
                            }

                        private var validated: Boolean = false

                        /**
                         * Validates that the types of all values in this object match their
                         * expected types recursively.
                         *
                         * This method is _not_ forwards compatible with new types from the API for
                         * existing fields.
                         *
                         * @throws IncreaseInvalidDataException if any value type in this object
                         *   doesn't match its expected type.
                         */
                        fun validate(): Result = apply {
                            if (validated) {
                                return@apply
                            }

                            known()
                            validated = true
                        }

                        fun isValid(): Boolean =
                            try {
                                validate()
                                true
                            } catch (e: IncreaseInvalidDataException) {
                                false
                            }

                        /**
                         * Returns a score indicating how many valid values are contained in this
                         * object recursively.
                         *
                         * Used for best match union deserialization.
                         */
                        @JvmSynthetic
                        internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

                        override fun equals(other: Any?): Boolean {
                            if (this === other) {
                                return true
                            }

                            return other is Result && value == other.value
                        }

                        override fun hashCode() = value.hashCode()

                        override fun toString() = value.toString()
                    }

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CardholderAddress &&
                            actualLine1 == other.actualLine1 &&
                            actualPostalCode == other.actualPostalCode &&
                            providedLine1 == other.providedLine1 &&
                            providedPostalCode == other.providedPostalCode &&
                            result == other.result &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            actualLine1,
                            actualPostalCode,
                            providedLine1,
                            providedPostalCode,
                            result,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}"
                }

                /** Cardholder name provided in the authorization request. */
                class CardholderName
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val providedFirstName: JsonField<String>,
                    private val providedLastName: JsonField<String>,
                    private val providedMiddleName: JsonField<String>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

                    @JsonCreator
                    private constructor(
                        @JsonProperty("provided_first_name")
                        @ExcludeMissing
                        providedFirstName: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_last_name")
                        @ExcludeMissing
                        providedLastName: JsonField<String> = JsonMissing.of(),
                        @JsonProperty("provided_middle_name")
                        @ExcludeMissing
                        providedMiddleName: JsonField<String> = JsonMissing.of(),
                    ) : this(
                        providedFirstName,
                        providedLastName,
                        providedMiddleName,
                        mutableMapOf(),
                    )

                    /**
                     * The first name provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedFirstName(): Optional<String> =
                        providedFirstName.getOptional("provided_first_name")

                    /**
                     * The last name provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedLastName(): Optional<String> =
                        providedLastName.getOptional("provided_last_name")

                    /**
                     * The middle name provided for verification in the authorization request.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   (e.g. if the server responded with an unexpected value).
                     */
                    fun providedMiddleName(): Optional<String> =
                        providedMiddleName.getOptional("provided_middle_name")

                    /**
                     * Returns the raw JSON value of [providedFirstName].
                     *
                     * Unlike [providedFirstName], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("provided_first_name")
                    @ExcludeMissing
                    fun _providedFirstName(): JsonField<String> = providedFirstName

                    /**
                     * Returns the raw JSON value of [providedLastName].
                     *
                     * Unlike [providedLastName], this method doesn't throw if the JSON field has an
                     * unexpected type.
                     */
                    @JsonProperty("provided_last_name")
                    @ExcludeMissing
                    fun _providedLastName(): JsonField<String> = providedLastName

                    /**
                     * Returns the raw JSON value of [providedMiddleName].
                     *
                     * Unlike [providedMiddleName], this method doesn't throw if the JSON field has
                     * an unexpected type.
                     */
                    @JsonProperty("provided_middle_name")
                    @ExcludeMissing
                    fun _providedMiddleName(): JsonField<String> = providedMiddleName

                    @JsonAnySetter
                    private fun putAdditionalProperty(key: String, value: JsonValue) {
                        additionalProperties.put(key, value)
                    }

                    @JsonAnyGetter
                    @ExcludeMissing
                    fun _additionalProperties(): Map<String, JsonValue> =
                        Collections.unmodifiableMap(additionalProperties)

                    fun toBuilder() = Builder().from(this)

                    companion object {

                        /**
                         * Returns a mutable builder for constructing an instance of
                         * [CardholderName].
                         *
                         * The following fields are required:
                         * ```java
                         * .providedFirstName()
                         * .providedLastName()
                         * .providedMiddleName()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

                    /** A builder for [CardholderName]. */
                    class Builder internal constructor() {

                        private var providedFirstName: JsonField<String>? = null
                        private var providedLastName: JsonField<String>? = null
                        private var providedMiddleName: JsonField<String>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(cardholderName: CardholderName) = apply {
                            providedFirstName = cardholderName.providedFirstName
                            providedLastName = cardholderName.providedLastName
                            providedMiddleName = cardholderName.providedMiddleName
                            additionalProperties =
                                cardholderName.additionalProperties.toMutableMap()
                        }

                        /**
                         * The first name provided for verification in the authorization request.
                         */
                        fun providedFirstName(providedFirstName: String?) =
                            providedFirstName(JsonField.ofNullable(providedFirstName))

                        /**
                         * Alias for calling [Builder.providedFirstName] with
                         * `providedFirstName.orElse(null)`.
                         */
                        fun providedFirstName(providedFirstName: Optional<String>) =
                            providedFirstName(providedFirstName.getOrNull())

                        /**
                         * Sets [Builder.providedFirstName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedFirstName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedFirstName(providedFirstName: JsonField<String>) = apply {
                            this.providedFirstName = providedFirstName
                        }

                        /** The last name provided for verification in the authorization request. */
                        fun providedLastName(providedLastName: String?) =
                            providedLastName(JsonField.ofNullable(providedLastName))

                        /**
                         * Alias for calling [Builder.providedLastName] with
                         * `providedLastName.orElse(null)`.
                         */
                        fun providedLastName(providedLastName: Optional<String>) =
                            providedLastName(providedLastName.getOrNull())

                        /**
                         * Sets [Builder.providedLastName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedLastName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedLastName(providedLastName: JsonField<String>) = apply {
                            this.providedLastName = providedLastName
                        }

                        /**
                         * The middle name provided for verification in the authorization request.
                         */
                        fun providedMiddleName(providedMiddleName: String?) =
                            providedMiddleName(JsonField.ofNullable(providedMiddleName))

                        /**
                         * Alias for calling [Builder.providedMiddleName] with
                         * `providedMiddleName.orElse(null)`.
                         */
                        fun providedMiddleName(providedMiddleName: Optional<String>) =
                            providedMiddleName(providedMiddleName.getOrNull())

                        /**
                         * Sets [Builder.providedMiddleName] to an arbitrary JSON value.
                         *
                         * You should usually call [Builder.providedMiddleName] with a well-typed
                         * [String] value instead. This method is primarily for setting the field to
                         * an undocumented or not yet supported value.
                         */
                        fun providedMiddleName(providedMiddleName: JsonField<String>) = apply {
                            this.providedMiddleName = providedMiddleName
                        }

                        fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
                            apply {
                                this.additionalProperties.clear()
                                putAllAdditionalProperties(additionalProperties)
                            }

                        fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                            additionalProperties.put(key, value)
                        }

                        fun putAllAdditionalProperties(
                            additionalProperties: Map<String, JsonValue>
                        ) = apply { this.additionalProperties.putAll(additionalProperties) }

                        fun removeAdditionalProperty(key: String) = apply {
                            additionalProperties.remove(key)
                        }

                        fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                            keys.forEach(::removeAdditionalProperty)
                        }

                        /**
                         * Returns an immutable instance of [CardholderName].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .providedFirstName()
                         * .providedLastName()
                         * .providedMiddleName()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): CardholderName =
                            CardholderName(
                                checkRequired("providedFirstName", providedFirstName),
                                checkRequired("providedLastName", providedLastName),
                                checkRequired("providedMiddleName", providedMiddleName),
                                additionalProperties.toMutableMap(),
                            )
                    }

                    private var validated: Boolean = false

                    /**
                     * Validates that the types of all values in this object match their expected
                     * types recursively.
                     *
                     * This method is _not_ forwards compatible with new types from the API for
                     * existing fields.
                     *
                     * @throws IncreaseInvalidDataException if any value type in this object doesn't
                     *   match its expected type.
                     */
                    fun validate(): CardholderName = apply {
                        if (validated) {
                            return@apply
                        }

                        providedFirstName()
                        providedLastName()
                        providedMiddleName()
                        validated = true
                    }

                    fun isValid(): Boolean =
                        try {
                            validate()
                            true
                        } catch (e: IncreaseInvalidDataException) {
                            false
                        }

                    /**
                     * Returns a score indicating how many valid values are contained in this object
                     * recursively.
                     *
                     * Used for best match union deserialization.
                     */
                    @JvmSynthetic
                    internal fun validity(): Int =
                        (if (providedFirstName.asKnown().isPresent) 1 else 0) +
                            (if (providedLastName.asKnown().isPresent) 1 else 0) +
                            (if (providedMiddleName.asKnown().isPresent) 1 else 0)

                    override fun equals(other: Any?): Boolean {
                        if (this === other) {
                            return true
                        }

                        return other is CardholderName &&
                            providedFirstName == other.providedFirstName &&
                            providedLastName == other.providedLastName &&
                            providedMiddleName == other.providedMiddleName &&
                            additionalProperties == other.additionalProperties
                    }

                    private val hashCode: Int by lazy {
                        Objects.hash(
                            providedFirstName,
                            providedLastName,
                            providedMiddleName,
                            additionalProperties,
                        )
                    }

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "CardholderName{providedFirstName=$providedFirstName, providedLastName=$providedLastName, providedMiddleName=$providedMiddleName, additionalProperties=$additionalProperties}"
                }

                override fun equals(other: Any?): Boolean {
                    if (this === other) {
                        return true
                    }

                    return other is Verification &&
                        cardVerificationCode == other.cardVerificationCode &&
                        cardholderAddress == other.cardholderAddress &&
                        cardholderName == other.cardholderName &&
                        additionalProperties == other.additionalProperties
                }

                private val hashCode: Int by lazy {
                    Objects.hash(
                        cardVerificationCode,
                        cardholderAddress,
                        cardholderName,
                        additionalProperties,
                    )
                }

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, cardholderName=$cardholderName, additionalProperties=$additionalProperties}"
            }

            override fun equals(other: Any?): Boolean {
                if (this === other) {
                    return true
                }

                return other is CardValidation &&
                    id == other.id &&
                    actioner == other.actioner &&
                    additionalAmounts == other.additionalAmounts &&
                    cardPaymentId == other.cardPaymentId &&
                    currency == other.currency &&
                    digitalWalletTokenId == other.digitalWalletTokenId &&
                    merchantAcceptorId == other.merchantAcceptorId &&
                    merchantCategoryCode == other.merchantCategoryCode &&
                    merchantCity == other.merchantCity &&
                    merchantCountry == other.merchantCountry &&
                    merchantDescriptor == other.merchantDescriptor &&
                    merchantPostalCode == other.merchantPostalCode &&
                    merchantState == other.merchantState &&
                    networkDetails == other.networkDetails &&
                    networkIdentifiers == other.networkIdentifiers &&
                    networkRiskScore == other.networkRiskScore &&
                    physicalCardId == other.physicalCardId &&
                    realTimeDecisionId == other.realTimeDecisionId &&
                    schemeFees == other.schemeFees &&
                    terminalId == other.terminalId &&
                    type == other.type &&
                    verification == other.verification &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    id,
                    actioner,
                    additionalAmounts,
                    cardPaymentId,
                    currency,
                    digitalWalletTokenId,
                    merchantAcceptorId,
                    merchantCategoryCode,
                    merchantCity,
                    merchantCountry,
                    merchantDescriptor,
                    merchantPostalCode,
                    merchantState,
                    networkDetails,
                    networkIdentifiers,
                    networkRiskScore,
                    physicalCardId,
                    realTimeDecisionId,
                    schemeFees,
                    terminalId,
                    type,
                    verification,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardValidation{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, realTimeDecisionId=$realTimeDecisionId, schemeFees=$schemeFees, terminalId=$terminalId, type=$type, verification=$verification, additionalProperties=$additionalProperties}"
        }

        /**
         * If the category of this Transaction source is equal to `other`, this field will contain
         * an empty object, otherwise it will contain null.
         */
        class Other
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(private val additionalProperties: MutableMap<String, JsonValue>) {

            @JsonCreator private constructor() : this(mutableMapOf())

            @JsonAnySetter
            private fun putAdditionalProperty(key: String, value: JsonValue) {
                additionalProperties.put(key, value)
            }

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map<String, JsonValue> =
                Collections.unmodifiableMap(additionalProperties)

            fun toBuilder() = Builder().from(this)

            companion object {

                /** Returns a mutable builder for constructing an instance of [Other]. */
                @JvmStatic fun builder() = Builder()
            }

            /** A builder for [Other]. */
            class Builder internal constructor() {

                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(other: Other) = apply {
                    additionalProperties = other.additionalProperties.toMutableMap()
                }

                fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                    this.additionalProperties.clear()
                    putAllAdditionalProperties(additionalProperties)
                }

                fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                    additionalProperties.put(key, value)
                }

                fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun removeAdditionalProperty(key: String) = apply {
                    additionalProperties.remove(key)
                }

                fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                    keys.forEach(::removeAdditionalProperty)
                }

                /**
                 * Returns an immutable instance of [Other].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 */
                fun build(): Other = Other(additionalProperties.toMutableMap())
            }

            private var validated: Boolean = false

            /**
             * Validates that the types of all values in this object match their expected types
             * recursively.
             *
             * This method is _not_ forwards compatible with new types from the API for existing
             * fields.
             *
             * @throws IncreaseInvalidDataException if any value type in this object doesn't match
             *   its expected type.
             */
            fun validate(): Other = apply {
                if (validated) {
                    return@apply
                }

                validated = true
            }

            fun isValid(): Boolean =
                try {
                    validate()
                    true
                } catch (e: IncreaseInvalidDataException) {
                    false
                }

            /**
             * Returns a score indicating how many valid values are contained in this object
             * recursively.
             *
             * Used for best match union deserialization.
             */
            @JvmSynthetic internal fun validity(): Int = 0

            override fun equals(other: Any?): Boolean {
                if (this === other) {
                    return true
                }

                return other is Other && additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy { Objects.hash(additionalProperties) }

            override fun hashCode(): Int = hashCode

            override fun toString() = "Other{additionalProperties=$additionalProperties}"
        }

        override fun equals(other: Any?): Boolean {
            if (this === other) {
                return true
            }

            return other is Element &&
                category == other.category &&
                createdAt == other.createdAt &&
                cardAuthentication == other.cardAuthentication &&
                cardAuthorization == other.cardAuthorization &&
                cardAuthorizationExpiration == other.cardAuthorizationExpiration &&
                cardBalanceInquiry == other.cardBalanceInquiry &&
                cardDecline == other.cardDecline &&
                cardFinancial == other.cardFinancial &&
                cardFuelConfirmation == other.cardFuelConfirmation &&
                cardIncrement == other.cardIncrement &&
                cardRefund == other.cardRefund &&
                cardReversal == other.cardReversal &&
                cardSettlement == other.cardSettlement &&
                cardValidation == other.cardValidation &&
                this.other == other.other &&
                additionalProperties == other.additionalProperties
        }

        private val hashCode: Int by lazy {
            Objects.hash(
                category,
                createdAt,
                cardAuthentication,
                cardAuthorization,
                cardAuthorizationExpiration,
                cardBalanceInquiry,
                cardDecline,
                cardFinancial,
                cardFuelConfirmation,
                cardIncrement,
                cardRefund,
                cardReversal,
                cardSettlement,
                cardValidation,
                other,
                additionalProperties,
            )
        }

        override fun hashCode(): Int = hashCode

        override fun toString() =
            "Element{category=$category, createdAt=$createdAt, cardAuthentication=$cardAuthentication, cardAuthorization=$cardAuthorization, cardAuthorizationExpiration=$cardAuthorizationExpiration, cardBalanceInquiry=$cardBalanceInquiry, cardDecline=$cardDecline, cardFinancial=$cardFinancial, cardFuelConfirmation=$cardFuelConfirmation, cardIncrement=$cardIncrement, cardRefund=$cardRefund, cardReversal=$cardReversal, cardSettlement=$cardSettlement, cardValidation=$cardValidation, other=$other, additionalProperties=$additionalProperties}"
    }

    /** The summarized state of this card payment. */
    class State
    @JsonCreator(mode = JsonCreator.Mode.DISABLED)
    private constructor(
        private val authorizedAmount: JsonField<Long>,
        private val fuelConfirmedAmount: JsonField<Long>,
        private val incrementedAmount: JsonField<Long>,
        private val refundAuthorizedAmount: JsonField<Long>,
        private val refundedAmount: JsonField<Long>,
        private val reversedAmount: JsonField<Long>,
        private val settledAmount: JsonField<Long>,
        private val additionalProperties: MutableMap<String, JsonValue>,
    ) {

        @JsonCreator
        private constructor(
            @JsonProperty("authorized_amount")
            @ExcludeMissing
            authorizedAmount: JsonField<Long> = JsonMissing.of(),
            @JsonProperty("fuel_confirmed_amount")
            @ExcludeMissing
            fuelConfirmedAmount: JsonField<Long> = JsonMissing.of(),
            @JsonProperty("incremented_amount")
            @ExcludeMissing
            incrementedAmount: JsonField<Long> = JsonMissing.of(),
            @JsonProperty("refund_authorized_amount")
            @ExcludeMissing
            refundAuthorizedAmount: JsonField<Long> = JsonMissing.of(),
            @JsonProperty("refunded_amount")
            @ExcludeMissing
            refundedAmount: JsonField<Long> = JsonMissing.of(),
            @JsonProperty("reversed_amount")
            @ExcludeMissing
            reversedAmount: JsonField<Long> = JsonMissing.of(),
            @JsonProperty("settled_amount")
            @ExcludeMissing
            settledAmount: JsonField<Long> = JsonMissing.of(),
        ) : this(
            authorizedAmount,
            fuelConfirmedAmount,
            incrementedAmount,
            refundAuthorizedAmount,
            refundedAmount,
            reversedAmount,
            settledAmount,
            mutableMapOf(),
        )

        /**
         * The total authorized amount in the minor unit of the transaction's currency. For dollars,
         * for example, this is cents.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
         *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
         */
        fun authorizedAmount(): Long = authorizedAmount.getRequired("authorized_amount")

        /**
         * The total amount from fuel confirmations in the minor unit of the transaction's currency.
         * For dollars, for example, this is cents.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
         *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
         */
        fun fuelConfirmedAmount(): Long = fuelConfirmedAmount.getRequired("fuel_confirmed_amount")

        /**
         * The total incrementally updated authorized amount in the minor unit of the transaction's
         * currency. For dollars, for example, this is cents.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
         *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
         */
        fun incrementedAmount(): Long = incrementedAmount.getRequired("incremented_amount")

        /**
         * The total refund authorized amount in the minor unit of the transaction's currency. For
         * dollars, for example, this is cents.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
         *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
         */
        fun refundAuthorizedAmount(): Long =
            refundAuthorizedAmount.getRequired("refund_authorized_amount")

        /**
         * The total refunded amount in the minor unit of the transaction's currency. For dollars,
         * for example, this is cents.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
         *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
         */
        fun refundedAmount(): Long = refundedAmount.getRequired("refunded_amount")

        /**
         * The total reversed amount in the minor unit of the transaction's currency. For dollars,
         * for example, this is cents.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
         *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
         */
        fun reversedAmount(): Long = reversedAmount.getRequired("reversed_amount")

        /**
         * The total settled amount in the minor unit of the transaction's currency. For dollars,
         * for example, this is cents.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
         *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
         */
        fun settledAmount(): Long = settledAmount.getRequired("settled_amount")

        /**
         * Returns the raw JSON value of [authorizedAmount].
         *
         * Unlike [authorizedAmount], this method doesn't throw if the JSON field has an unexpected
         * type.
         */
        @JsonProperty("authorized_amount")
        @ExcludeMissing
        fun _authorizedAmount(): JsonField<Long> = authorizedAmount

        /**
         * Returns the raw JSON value of [fuelConfirmedAmount].
         *
         * Unlike [fuelConfirmedAmount], this method doesn't throw if the JSON field has an
         * unexpected type.
         */
        @JsonProperty("fuel_confirmed_amount")
        @ExcludeMissing
        fun _fuelConfirmedAmount(): JsonField<Long> = fuelConfirmedAmount

        /**
         * Returns the raw JSON value of [incrementedAmount].
         *
         * Unlike [incrementedAmount], this method doesn't throw if the JSON field has an unexpected
         * type.
         */
        @JsonProperty("incremented_amount")
        @ExcludeMissing
        fun _incrementedAmount(): JsonField<Long> = incrementedAmount

        /**
         * Returns the raw JSON value of [refundAuthorizedAmount].
         *
         * Unlike [refundAuthorizedAmount], this method doesn't throw if the JSON field has an
         * unexpected type.
         */
        @JsonProperty("refund_authorized_amount")
        @ExcludeMissing
        fun _refundAuthorizedAmount(): JsonField<Long> = refundAuthorizedAmount

        /**
         * Returns the raw JSON value of [refundedAmount].
         *
         * Unlike [refundedAmount], this method doesn't throw if the JSON field has an unexpected
         * type.
         */
        @JsonProperty("refunded_amount")
        @ExcludeMissing
        fun _refundedAmount(): JsonField<Long> = refundedAmount

        /**
         * Returns the raw JSON value of [reversedAmount].
         *
         * Unlike [reversedAmount], this method doesn't throw if the JSON field has an unexpected
         * type.
         */
        @JsonProperty("reversed_amount")
        @ExcludeMissing
        fun _reversedAmount(): JsonField<Long> = reversedAmount

        /**
         * Returns the raw JSON value of [settledAmount].
         *
         * Unlike [settledAmount], this method doesn't throw if the JSON field has an unexpected
         * type.
         */
        @JsonProperty("settled_amount")
        @ExcludeMissing
        fun _settledAmount(): JsonField<Long> = settledAmount

        @JsonAnySetter
        private fun putAdditionalProperty(key: String, value: JsonValue) {
            additionalProperties.put(key, value)
        }

        @JsonAnyGetter
        @ExcludeMissing
        fun _additionalProperties(): Map<String, JsonValue> =
            Collections.unmodifiableMap(additionalProperties)

        fun toBuilder() = Builder().from(this)

        companion object {

            /**
             * Returns a mutable builder for constructing an instance of [State].
             *
             * The following fields are required:
             * ```java
             * .authorizedAmount()
             * .fuelConfirmedAmount()
             * .incrementedAmount()
             * .refundAuthorizedAmount()
             * .refundedAmount()
             * .reversedAmount()
             * .settledAmount()
             * ```
             */
            @JvmStatic fun builder() = Builder()
        }

        /** A builder for [State]. */
        class Builder internal constructor() {

            private var authorizedAmount: JsonField<Long>? = null
            private var fuelConfirmedAmount: JsonField<Long>? = null
            private var incrementedAmount: JsonField<Long>? = null
            private var refundAuthorizedAmount: JsonField<Long>? = null
            private var refundedAmount: JsonField<Long>? = null
            private var reversedAmount: JsonField<Long>? = null
            private var settledAmount: JsonField<Long>? = null
            private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

            @JvmSynthetic
            internal fun from(state: State) = apply {
                authorizedAmount = state.authorizedAmount
                fuelConfirmedAmount = state.fuelConfirmedAmount
                incrementedAmount = state.incrementedAmount
                refundAuthorizedAmount = state.refundAuthorizedAmount
                refundedAmount = state.refundedAmount
                reversedAmount = state.reversedAmount
                settledAmount = state.settledAmount
                additionalProperties = state.additionalProperties.toMutableMap()
            }

            /**
             * The total authorized amount in the minor unit of the transaction's currency. For
             * dollars, for example, this is cents.
             */
            fun authorizedAmount(authorizedAmount: Long) =
                authorizedAmount(JsonField.of(authorizedAmount))

            /**
             * Sets [Builder.authorizedAmount] to an arbitrary JSON value.
             *
             * You should usually call [Builder.authorizedAmount] with a well-typed [Long] value
             * instead. This method is primarily for setting the field to an undocumented or not yet
             * supported value.
             */
            fun authorizedAmount(authorizedAmount: JsonField<Long>) = apply {
                this.authorizedAmount = authorizedAmount
            }

            /**
             * The total amount from fuel confirmations in the minor unit of the transaction's
             * currency. For dollars, for example, this is cents.
             */
            fun fuelConfirmedAmount(fuelConfirmedAmount: Long) =
                fuelConfirmedAmount(JsonField.of(fuelConfirmedAmount))

            /**
             * Sets [Builder.fuelConfirmedAmount] to an arbitrary JSON value.
             *
             * You should usually call [Builder.fuelConfirmedAmount] with a well-typed [Long] value
             * instead. This method is primarily for setting the field to an undocumented or not yet
             * supported value.
             */
            fun fuelConfirmedAmount(fuelConfirmedAmount: JsonField<Long>) = apply {
                this.fuelConfirmedAmount = fuelConfirmedAmount
            }

            /**
             * The total incrementally updated authorized amount in the minor unit of the
             * transaction's currency. For dollars, for example, this is cents.
             */
            fun incrementedAmount(incrementedAmount: Long) =
                incrementedAmount(JsonField.of(incrementedAmount))

            /**
             * Sets [Builder.incrementedAmount] to an arbitrary JSON value.
             *
             * You should usually call [Builder.incrementedAmount] with a well-typed [Long] value
             * instead. This method is primarily for setting the field to an undocumented or not yet
             * supported value.
             */
            fun incrementedAmount(incrementedAmount: JsonField<Long>) = apply {
                this.incrementedAmount = incrementedAmount
            }

            /**
             * The total refund authorized amount in the minor unit of the transaction's currency.
             * For dollars, for example, this is cents.
             */
            fun refundAuthorizedAmount(refundAuthorizedAmount: Long) =
                refundAuthorizedAmount(JsonField.of(refundAuthorizedAmount))

            /**
             * Sets [Builder.refundAuthorizedAmount] to an arbitrary JSON value.
             *
             * You should usually call [Builder.refundAuthorizedAmount] with a well-typed [Long]
             * value instead. This method is primarily for setting the field to an undocumented or
             * not yet supported value.
             */
            fun refundAuthorizedAmount(refundAuthorizedAmount: JsonField<Long>) = apply {
                this.refundAuthorizedAmount = refundAuthorizedAmount
            }

            /**
             * The total refunded amount in the minor unit of the transaction's currency. For
             * dollars, for example, this is cents.
             */
            fun refundedAmount(refundedAmount: Long) = refundedAmount(JsonField.of(refundedAmount))

            /**
             * Sets [Builder.refundedAmount] to an arbitrary JSON value.
             *
             * You should usually call [Builder.refundedAmount] with a well-typed [Long] value
             * instead. This method is primarily for setting the field to an undocumented or not yet
             * supported value.
             */
            fun refundedAmount(refundedAmount: JsonField<Long>) = apply {
                this.refundedAmount = refundedAmount
            }

            /**
             * The total reversed amount in the minor unit of the transaction's currency. For
             * dollars, for example, this is cents.
             */
            fun reversedAmount(reversedAmount: Long) = reversedAmount(JsonField.of(reversedAmount))

            /**
             * Sets [Builder.reversedAmount] to an arbitrary JSON value.
             *
             * You should usually call [Builder.reversedAmount] with a well-typed [Long] value
             * instead. This method is primarily for setting the field to an undocumented or not yet
             * supported value.
             */
            fun reversedAmount(reversedAmount: JsonField<Long>) = apply {
                this.reversedAmount = reversedAmount
            }

            /**
             * The total settled amount in the minor unit of the transaction's currency. For
             * dollars, for example, this is cents.
             */
            fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount))

            /**
             * Sets [Builder.settledAmount] to an arbitrary JSON value.
             *
             * You should usually call [Builder.settledAmount] with a well-typed [Long] value
             * instead. This method is primarily for setting the field to an undocumented or not yet
             * supported value.
             */
            fun settledAmount(settledAmount: JsonField<Long>) = apply {
                this.settledAmount = settledAmount
            }

            fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                this.additionalProperties.clear()
                putAllAdditionalProperties(additionalProperties)
            }

            fun putAdditionalProperty(key: String, value: JsonValue) = apply {
                additionalProperties.put(key, value)
            }

            fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
                this.additionalProperties.putAll(additionalProperties)
            }

            fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }

            fun removeAllAdditionalProperties(keys: Set<String>) = apply {
                keys.forEach(::removeAdditionalProperty)
            }

            /**
             * Returns an immutable instance of [State].
             *
             * Further updates to this [Builder] will not mutate the returned instance.
             *
             * The following fields are required:
             * ```java
             * .authorizedAmount()
             * .fuelConfirmedAmount()
             * .incrementedAmount()
             * .refundAuthorizedAmount()
             * .refundedAmount()
             * .reversedAmount()
             * .settledAmount()
             * ```
             *
             * @throws IllegalStateException if any required field is unset.
             */
            fun build(): State =
                State(
                    checkRequired("authorizedAmount", authorizedAmount),
                    checkRequired("fuelConfirmedAmount", fuelConfirmedAmount),
                    checkRequired("incrementedAmount", incrementedAmount),
                    checkRequired("refundAuthorizedAmount", refundAuthorizedAmount),
                    checkRequired("refundedAmount", refundedAmount),
                    checkRequired("reversedAmount", reversedAmount),
                    checkRequired("settledAmount", settledAmount),
                    additionalProperties.toMutableMap(),
                )
        }

        private var validated: Boolean = false

        /**
         * Validates that the types of all values in this object match their expected types
         * recursively.
         *
         * This method is _not_ forwards compatible with new types from the API for existing fields.
         *
         * @throws IncreaseInvalidDataException if any value type in this object doesn't match its
         *   expected type.
         */
        fun validate(): State = apply {
            if (validated) {
                return@apply
            }

            authorizedAmount()
            fuelConfirmedAmount()
            incrementedAmount()
            refundAuthorizedAmount()
            refundedAmount()
            reversedAmount()
            settledAmount()
            validated = true
        }

        fun isValid(): Boolean =
            try {
                validate()
                true
            } catch (e: IncreaseInvalidDataException) {
                false
            }

        /**
         * Returns a score indicating how many valid values are contained in this object
         * recursively.
         *
         * Used for best match union deserialization.
         */
        @JvmSynthetic
        internal fun validity(): Int =
            (if (authorizedAmount.asKnown().isPresent) 1 else 0) +
                (if (fuelConfirmedAmount.asKnown().isPresent) 1 else 0) +
                (if (incrementedAmount.asKnown().isPresent) 1 else 0) +
                (if (refundAuthorizedAmount.asKnown().isPresent) 1 else 0) +
                (if (refundedAmount.asKnown().isPresent) 1 else 0) +
                (if (reversedAmount.asKnown().isPresent) 1 else 0) +
                (if (settledAmount.asKnown().isPresent) 1 else 0)

        override fun equals(other: Any?): Boolean {
            if (this === other) {
                return true
            }

            return other is State &&
                authorizedAmount == other.authorizedAmount &&
                fuelConfirmedAmount == other.fuelConfirmedAmount &&
                incrementedAmount == other.incrementedAmount &&
                refundAuthorizedAmount == other.refundAuthorizedAmount &&
                refundedAmount == other.refundedAmount &&
                reversedAmount == other.reversedAmount &&
                settledAmount == other.settledAmount &&
                additionalProperties == other.additionalProperties
        }

        private val hashCode: Int by lazy {
            Objects.hash(
                authorizedAmount,
                fuelConfirmedAmount,
                incrementedAmount,
                refundAuthorizedAmount,
                refundedAmount,
                reversedAmount,
                settledAmount,
                additionalProperties,
            )
        }

        override fun hashCode(): Int = hashCode

        override fun toString() =
            "State{authorizedAmount=$authorizedAmount, fuelConfirmedAmount=$fuelConfirmedAmount, incrementedAmount=$incrementedAmount, refundAuthorizedAmount=$refundAuthorizedAmount, refundedAmount=$refundedAmount, reversedAmount=$reversedAmount, settledAmount=$settledAmount, additionalProperties=$additionalProperties}"
    }

    /**
     * A constant representing the object's type. For this resource it will always be
     * `card_payment`.
     */
    class Type @JsonCreator private constructor(private val value: JsonField<String>) : Enum {

        /**
         * Returns this class instance's raw value.
         *
         * This is usually only useful if this instance was deserialized from data that doesn't
         * match any known member, and you want to know that value. For example, if the SDK is on an
         * older version than the API, then the API may respond with new members that the SDK is
         * unaware of.
         */
        @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

        companion object {

            @JvmField val CARD_PAYMENT = of("card_payment")

            @JvmStatic fun of(value: String) = Type(JsonField.of(value))
        }

        /** An enum containing [Type]'s known values. */
        enum class Known {
            CARD_PAYMENT
        }

        /**
         * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
         *
         * An instance of [Type] can contain an unknown value in a couple of cases:
         * - It was deserialized from data that doesn't match any known member. For example, if the
         *   SDK is on an older version than the API, then the API may respond with new members that
         *   the SDK is unaware of.
         * - It was constructed with an arbitrary value using the [of] method.
         */
        enum class Value {
            CARD_PAYMENT,
            /** An enum member indicating that [Type] was instantiated with an unknown value. */
            _UNKNOWN,
        }

        /**
         * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
         * if the class was instantiated with an unknown value.
         *
         * Use the [known] method instead if you're certain the value is always known or if you want
         * to throw for the unknown case.
         */
        fun value(): Value =
            when (this) {
                CARD_PAYMENT -> Value.CARD_PAYMENT
                else -> Value._UNKNOWN
            }

        /**
         * Returns an enum member corresponding to this class instance's value.
         *
         * Use the [value] method instead if you're uncertain the value is always known and don't
         * want to throw for the unknown case.
         *
         * @throws IncreaseInvalidDataException if this class instance's value is a not a known
         *   member.
         */
        fun known(): Known =
            when (this) {
                CARD_PAYMENT -> Known.CARD_PAYMENT
                else -> throw IncreaseInvalidDataException("Unknown Type: $value")
            }

        /**
         * Returns this class instance's primitive wire representation.
         *
         * This differs from the [toString] method because that method is primarily for debugging
         * and generally doesn't throw.
         *
         * @throws IncreaseInvalidDataException if this class instance's value does not have the
         *   expected primitive type.
         */
        fun asString(): String =
            _value().asString().orElseThrow {
                IncreaseInvalidDataException("Value is not a String")
            }

        private var validated: Boolean = false

        /**
         * Validates that the types of all values in this object match their expected types
         * recursively.
         *
         * This method is _not_ forwards compatible with new types from the API for existing fields.
         *
         * @throws IncreaseInvalidDataException if any value type in this object doesn't match its
         *   expected type.
         */
        fun validate(): Type = apply {
            if (validated) {
                return@apply
            }

            known()
            validated = true
        }

        fun isValid(): Boolean =
            try {
                validate()
                true
            } catch (e: IncreaseInvalidDataException) {
                false
            }

        /**
         * Returns a score indicating how many valid values are contained in this object
         * recursively.
         *
         * Used for best match union deserialization.
         */
        @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1

        override fun equals(other: Any?): Boolean {
            if (this === other) {
                return true
            }

            return other is Type && value == other.value
        }

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) {
            return true
        }

        return other is CardPayment &&
            id == other.id &&
            accountId == other.accountId &&
            cardId == other.cardId &&
            createdAt == other.createdAt &&
            digitalWalletTokenId == other.digitalWalletTokenId &&
            elements == other.elements &&
            physicalCardId == other.physicalCardId &&
            state == other.state &&
            type == other.type &&
            additionalProperties == other.additionalProperties
    }

    private val hashCode: Int by lazy {
        Objects.hash(
            id,
            accountId,
            cardId,
            createdAt,
            digitalWalletTokenId,
            elements,
            physicalCardId,
            state,
            type,
            additionalProperties,
        )
    }

    override fun hashCode(): Int = hashCode

    override fun toString() =
        "CardPayment{id=$id, accountId=$accountId, cardId=$cardId, createdAt=$createdAt, digitalWalletTokenId=$digitalWalletTokenId, elements=$elements, physicalCardId=$physicalCardId, state=$state, type=$type, additionalProperties=$additionalProperties}"
}
