// File generated from our OpenAPI spec by Stainless.

package com.increase.api.models.transactions

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

/**
 * Transactions are the immutable additions and removals of money from your bank account. They're
 * the equivalent of line items on your bank statement. To learn more, see
 * [Transactions and Transfers](/documentation/transactions-transfers).
 */
class Transaction
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
    private val id: JsonField<String>,
    private val accountId: JsonField<String>,
    private val amount: JsonField<Long>,
    private val createdAt: JsonField<OffsetDateTime>,
    private val currency: JsonField<Currency>,
    private val description: JsonField<String>,
    private val routeId: JsonField<String>,
    private val routeType: JsonField<RouteType>,
    private val source: JsonField<Source>,
    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("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
        @JsonProperty("created_at")
        @ExcludeMissing
        createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
        @JsonProperty("currency") @ExcludeMissing currency: JsonField<Currency> = JsonMissing.of(),
        @JsonProperty("description")
        @ExcludeMissing
        description: JsonField<String> = JsonMissing.of(),
        @JsonProperty("route_id") @ExcludeMissing routeId: JsonField<String> = JsonMissing.of(),
        @JsonProperty("route_type")
        @ExcludeMissing
        routeType: JsonField<RouteType> = JsonMissing.of(),
        @JsonProperty("source") @ExcludeMissing source: JsonField<Source> = JsonMissing.of(),
        @JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
    ) : this(
        id,
        accountId,
        amount,
        createdAt,
        currency,
        description,
        routeId,
        routeType,
        source,
        type,
        mutableMapOf(),
    )

    /**
     * The Transaction 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 Transaction amount in the minor unit of its 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 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Transaction
     * occurred.
     *
     * @throws IncreaseInvalidDataException if 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 Transaction's currency.
     * This will match the currency on the Transaction's Account.
     *
     * @throws IncreaseInvalidDataException if 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")

    /**
     * An informational message describing this transaction. Use the fields in `source` to get more
     * detailed information. This field appears as the line-item on the statement.
     *
     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
     *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
     */
    fun description(): String = description.getRequired("description")

    /**
     * The identifier for the route this Transaction came through. Routes are things like cards and
     * ACH details.
     *
     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the
     *   server responded with an unexpected value).
     */
    fun routeId(): Optional<String> = routeId.getOptional("route_id")

    /**
     * The type of the route this Transaction came through.
     *
     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the
     *   server responded with an unexpected value).
     */
    fun routeType(): Optional<RouteType> = routeType.getOptional("route_type")

    /**
     * This is an object giving more details on the network-level event that caused the Transaction.
     * Note that for backwards compatibility reasons, additional undocumented keys may appear in
     * this object. These should be treated as deprecated and will be removed in the future.
     *
     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
     *   unexpectedly missing or null (e.g. if the server responded with an unexpected value).
     */
    fun source(): Source = source.getRequired("source")

    /**
     * A constant representing the object's type. For this resource it will always be `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 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 [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 [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 [description].
     *
     * Unlike [description], this method doesn't throw if the JSON field has an unexpected type.
     */
    @JsonProperty("description") @ExcludeMissing fun _description(): JsonField<String> = description

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

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

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

    /**
     * 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 [Transaction].
         *
         * The following fields are required:
         * ```java
         * .id()
         * .accountId()
         * .amount()
         * .createdAt()
         * .currency()
         * .description()
         * .routeId()
         * .routeType()
         * .source()
         * .type()
         * ```
         */
        @JvmStatic fun builder() = Builder()
    }

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

        private var id: JsonField<String>? = null
        private var accountId: JsonField<String>? = null
        private var amount: JsonField<Long>? = null
        private var createdAt: JsonField<OffsetDateTime>? = null
        private var currency: JsonField<Currency>? = null
        private var description: JsonField<String>? = null
        private var routeId: JsonField<String>? = null
        private var routeType: JsonField<RouteType>? = null
        private var source: JsonField<Source>? = null
        private var type: JsonField<Type>? = null
        private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

        @JvmSynthetic
        internal fun from(transaction: Transaction) = apply {
            id = transaction.id
            accountId = transaction.accountId
            amount = transaction.amount
            createdAt = transaction.createdAt
            currency = transaction.currency
            description = transaction.description
            routeId = transaction.routeId
            routeType = transaction.routeType
            source = transaction.source
            type = transaction.type
            additionalProperties = transaction.additionalProperties.toMutableMap()
        }

        /** The Transaction 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 Transaction amount in the minor unit of its 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 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the
         * Transaction occurred.
         */
        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 Transaction's
         * currency. This will match the currency on the Transaction's Account.
         */
        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 }

        /**
         * An informational message describing this transaction. Use the fields in `source` to get
         * more detailed information. This field appears as the line-item on the statement.
         */
        fun description(description: String) = description(JsonField.of(description))

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

        /**
         * The identifier for the route this Transaction came through. Routes are things like cards
         * and ACH details.
         */
        fun routeId(routeId: String?) = routeId(JsonField.ofNullable(routeId))

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

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

        /** The type of the route this Transaction came through. */
        fun routeType(routeType: RouteType?) = routeType(JsonField.ofNullable(routeType))

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

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

        /**
         * This is an object giving more details on the network-level event that caused the
         * Transaction. Note that for backwards compatibility reasons, additional undocumented keys
         * may appear in this object. These should be treated as deprecated and will be removed in
         * the future.
         */
        fun source(source: Source) = source(JsonField.of(source))

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

        /**
         * A constant representing the object's type. For this resource it will always be
         * `transaction`.
         */
        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 [Transaction].
         *
         * Further updates to this [Builder] will not mutate the returned instance.
         *
         * The following fields are required:
         * ```java
         * .id()
         * .accountId()
         * .amount()
         * .createdAt()
         * .currency()
         * .description()
         * .routeId()
         * .routeType()
         * .source()
         * .type()
         * ```
         *
         * @throws IllegalStateException if any required field is unset.
         */
        fun build(): Transaction =
            Transaction(
                checkRequired("id", id),
                checkRequired("accountId", accountId),
                checkRequired("amount", amount),
                checkRequired("createdAt", createdAt),
                checkRequired("currency", currency),
                checkRequired("description", description),
                checkRequired("routeId", routeId),
                checkRequired("routeType", routeType),
                checkRequired("source", source),
                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(): Transaction = apply {
        if (validated) {
            return@apply
        }

        id()
        accountId()
        amount()
        createdAt()
        currency().validate()
        description()
        routeId()
        routeType().ifPresent { it.validate() }
        source().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 (amount.asKnown().isPresent) 1 else 0) +
            (if (createdAt.asKnown().isPresent) 1 else 0) +
            (currency.asKnown().getOrNull()?.validity() ?: 0) +
            (if (description.asKnown().isPresent) 1 else 0) +
            (if (routeId.asKnown().isPresent) 1 else 0) +
            (routeType.asKnown().getOrNull()?.validity() ?: 0) +
            (source.asKnown().getOrNull()?.validity() ?: 0) +
            (type.asKnown().getOrNull()?.validity() ?: 0)

    /**
     * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the Transaction's currency.
     * This will match the currency on the Transaction's Account.
     */
    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 the route this Transaction came through. */
    class RouteType @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 {

            /** An Account Number. */
            @JvmField val ACCOUNT_NUMBER = of("account_number")

            /** A Card. */
            @JvmField val CARD = of("card")

            /** A Lockbox. */
            @JvmField val LOCKBOX = of("lockbox")

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

        /** An enum containing [RouteType]'s known values. */
        enum class Known {
            /** An Account Number. */
            ACCOUNT_NUMBER,
            /** A Card. */
            CARD,
            /** A Lockbox. */
            LOCKBOX,
        }

        /**
         * An enum containing [RouteType]'s known values, as well as an [_UNKNOWN] member.
         *
         * An instance of [RouteType] 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 {
            /** An Account Number. */
            ACCOUNT_NUMBER,
            /** A Card. */
            CARD,
            /** A Lockbox. */
            LOCKBOX,
            /**
             * An enum member indicating that [RouteType] 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_NUMBER -> Value.ACCOUNT_NUMBER
                CARD -> Value.CARD
                LOCKBOX -> Value.LOCKBOX
                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_NUMBER -> Known.ACCOUNT_NUMBER
                CARD -> Known.CARD
                LOCKBOX -> Known.LOCKBOX
                else -> throw IncreaseInvalidDataException("Unknown RouteType: $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(): RouteType = 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 RouteType && value == other.value
        }

        override fun hashCode() = value.hashCode()

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

    /**
     * This is an object giving more details on the network-level event that caused the Transaction.
     * Note that for backwards compatibility reasons, additional undocumented keys may appear in
     * this object. These should be treated as deprecated and will be removed in the future.
     */
    class Source
    @JsonCreator(mode = JsonCreator.Mode.DISABLED)
    private constructor(
        private val category: JsonField<Category>,
        private val accountRevenuePayment: JsonField<AccountRevenuePayment>,
        private val accountTransferIntention: JsonField<AccountTransferIntention>,
        private val achTransferIntention: JsonField<AchTransferIntention>,
        private val achTransferRejection: JsonField<AchTransferRejection>,
        private val achTransferReturn: JsonField<AchTransferReturn>,
        private val blockchainOfframpTransferSettlement:
            JsonField<BlockchainOfframpTransferSettlement>,
        private val blockchainOnrampTransferIntention: JsonField<BlockchainOnrampTransferIntention>,
        private val cardDisputeAcceptance: JsonField<CardDisputeAcceptance>,
        private val cardDisputeFinancial: JsonField<CardDisputeFinancial>,
        private val cardDisputeLoss: JsonField<CardDisputeLoss>,
        private val cardFinancial: JsonField<CardFinancial>,
        private val cardPushTransferAcceptance: JsonField<CardPushTransferAcceptance>,
        private val cardRefund: JsonField<CardRefund>,
        private val cardRevenuePayment: JsonField<CardRevenuePayment>,
        private val cardSettlement: JsonField<CardSettlement>,
        private val cashbackPayment: JsonField<CashbackPayment>,
        private val checkDepositAcceptance: JsonField<CheckDepositAcceptance>,
        private val checkDepositReturn: JsonField<CheckDepositReturn>,
        private val checkTransferDeposit: JsonField<CheckTransferDeposit>,
        private val fednowTransferAcknowledgement: JsonField<FednowTransferAcknowledgement>,
        private val feePayment: JsonField<FeePayment>,
        private val inboundAchTransfer: JsonField<InboundAchTransfer>,
        private val inboundAchTransferReturnIntention: JsonField<InboundAchTransferReturnIntention>,
        private val inboundCheckAdjustment: JsonField<InboundCheckAdjustment>,
        private val inboundCheckDepositReturnIntention:
            JsonField<InboundCheckDepositReturnIntention>,
        private val inboundFednowTransferConfirmation: JsonField<InboundFednowTransferConfirmation>,
        private val inboundRealTimePaymentsTransferConfirmation:
            JsonField<InboundRealTimePaymentsTransferConfirmation>,
        private val inboundWireReversal: JsonField<InboundWireReversal>,
        private val inboundWireTransfer: JsonField<InboundWireTransfer>,
        private val inboundWireTransferReversal: JsonField<InboundWireTransferReversal>,
        private val interestPayment: JsonField<InterestPayment>,
        private val internalSource: JsonField<InternalSource>,
        private val other: JsonField<Other>,
        private val realTimePaymentsTransferAcknowledgement:
            JsonField<RealTimePaymentsTransferAcknowledgement>,
        private val sampleFunds: JsonField<SampleFunds>,
        private val swiftTransferIntention: JsonField<SwiftTransferIntention>,
        private val swiftTransferReturn: JsonField<SwiftTransferReturn>,
        private val wireTransferIntention: JsonField<WireTransferIntention>,
        private val additionalProperties: MutableMap<String, JsonValue>,
    ) {

        @JsonCreator
        private constructor(
            @JsonProperty("category")
            @ExcludeMissing
            category: JsonField<Category> = JsonMissing.of(),
            @JsonProperty("account_revenue_payment")
            @ExcludeMissing
            accountRevenuePayment: JsonField<AccountRevenuePayment> = JsonMissing.of(),
            @JsonProperty("account_transfer_intention")
            @ExcludeMissing
            accountTransferIntention: JsonField<AccountTransferIntention> = JsonMissing.of(),
            @JsonProperty("ach_transfer_intention")
            @ExcludeMissing
            achTransferIntention: JsonField<AchTransferIntention> = JsonMissing.of(),
            @JsonProperty("ach_transfer_rejection")
            @ExcludeMissing
            achTransferRejection: JsonField<AchTransferRejection> = JsonMissing.of(),
            @JsonProperty("ach_transfer_return")
            @ExcludeMissing
            achTransferReturn: JsonField<AchTransferReturn> = JsonMissing.of(),
            @JsonProperty("blockchain_offramp_transfer_settlement")
            @ExcludeMissing
            blockchainOfframpTransferSettlement: JsonField<BlockchainOfframpTransferSettlement> =
                JsonMissing.of(),
            @JsonProperty("blockchain_onramp_transfer_intention")
            @ExcludeMissing
            blockchainOnrampTransferIntention: JsonField<BlockchainOnrampTransferIntention> =
                JsonMissing.of(),
            @JsonProperty("card_dispute_acceptance")
            @ExcludeMissing
            cardDisputeAcceptance: JsonField<CardDisputeAcceptance> = JsonMissing.of(),
            @JsonProperty("card_dispute_financial")
            @ExcludeMissing
            cardDisputeFinancial: JsonField<CardDisputeFinancial> = JsonMissing.of(),
            @JsonProperty("card_dispute_loss")
            @ExcludeMissing
            cardDisputeLoss: JsonField<CardDisputeLoss> = JsonMissing.of(),
            @JsonProperty("card_financial")
            @ExcludeMissing
            cardFinancial: JsonField<CardFinancial> = JsonMissing.of(),
            @JsonProperty("card_push_transfer_acceptance")
            @ExcludeMissing
            cardPushTransferAcceptance: JsonField<CardPushTransferAcceptance> = JsonMissing.of(),
            @JsonProperty("card_refund")
            @ExcludeMissing
            cardRefund: JsonField<CardRefund> = JsonMissing.of(),
            @JsonProperty("card_revenue_payment")
            @ExcludeMissing
            cardRevenuePayment: JsonField<CardRevenuePayment> = JsonMissing.of(),
            @JsonProperty("card_settlement")
            @ExcludeMissing
            cardSettlement: JsonField<CardSettlement> = JsonMissing.of(),
            @JsonProperty("cashback_payment")
            @ExcludeMissing
            cashbackPayment: JsonField<CashbackPayment> = JsonMissing.of(),
            @JsonProperty("check_deposit_acceptance")
            @ExcludeMissing
            checkDepositAcceptance: JsonField<CheckDepositAcceptance> = JsonMissing.of(),
            @JsonProperty("check_deposit_return")
            @ExcludeMissing
            checkDepositReturn: JsonField<CheckDepositReturn> = JsonMissing.of(),
            @JsonProperty("check_transfer_deposit")
            @ExcludeMissing
            checkTransferDeposit: JsonField<CheckTransferDeposit> = JsonMissing.of(),
            @JsonProperty("fednow_transfer_acknowledgement")
            @ExcludeMissing
            fednowTransferAcknowledgement: JsonField<FednowTransferAcknowledgement> =
                JsonMissing.of(),
            @JsonProperty("fee_payment")
            @ExcludeMissing
            feePayment: JsonField<FeePayment> = JsonMissing.of(),
            @JsonProperty("inbound_ach_transfer")
            @ExcludeMissing
            inboundAchTransfer: JsonField<InboundAchTransfer> = JsonMissing.of(),
            @JsonProperty("inbound_ach_transfer_return_intention")
            @ExcludeMissing
            inboundAchTransferReturnIntention: JsonField<InboundAchTransferReturnIntention> =
                JsonMissing.of(),
            @JsonProperty("inbound_check_adjustment")
            @ExcludeMissing
            inboundCheckAdjustment: JsonField<InboundCheckAdjustment> = JsonMissing.of(),
            @JsonProperty("inbound_check_deposit_return_intention")
            @ExcludeMissing
            inboundCheckDepositReturnIntention: JsonField<InboundCheckDepositReturnIntention> =
                JsonMissing.of(),
            @JsonProperty("inbound_fednow_transfer_confirmation")
            @ExcludeMissing
            inboundFednowTransferConfirmation: JsonField<InboundFednowTransferConfirmation> =
                JsonMissing.of(),
            @JsonProperty("inbound_real_time_payments_transfer_confirmation")
            @ExcludeMissing
            inboundRealTimePaymentsTransferConfirmation:
                JsonField<InboundRealTimePaymentsTransferConfirmation> =
                JsonMissing.of(),
            @JsonProperty("inbound_wire_reversal")
            @ExcludeMissing
            inboundWireReversal: JsonField<InboundWireReversal> = JsonMissing.of(),
            @JsonProperty("inbound_wire_transfer")
            @ExcludeMissing
            inboundWireTransfer: JsonField<InboundWireTransfer> = JsonMissing.of(),
            @JsonProperty("inbound_wire_transfer_reversal")
            @ExcludeMissing
            inboundWireTransferReversal: JsonField<InboundWireTransferReversal> = JsonMissing.of(),
            @JsonProperty("interest_payment")
            @ExcludeMissing
            interestPayment: JsonField<InterestPayment> = JsonMissing.of(),
            @JsonProperty("internal_source")
            @ExcludeMissing
            internalSource: JsonField<InternalSource> = JsonMissing.of(),
            @JsonProperty("other") @ExcludeMissing other: JsonField<Other> = JsonMissing.of(),
            @JsonProperty("real_time_payments_transfer_acknowledgement")
            @ExcludeMissing
            realTimePaymentsTransferAcknowledgement:
                JsonField<RealTimePaymentsTransferAcknowledgement> =
                JsonMissing.of(),
            @JsonProperty("sample_funds")
            @ExcludeMissing
            sampleFunds: JsonField<SampleFunds> = JsonMissing.of(),
            @JsonProperty("swift_transfer_intention")
            @ExcludeMissing
            swiftTransferIntention: JsonField<SwiftTransferIntention> = JsonMissing.of(),
            @JsonProperty("swift_transfer_return")
            @ExcludeMissing
            swiftTransferReturn: JsonField<SwiftTransferReturn> = JsonMissing.of(),
            @JsonProperty("wire_transfer_intention")
            @ExcludeMissing
            wireTransferIntention: JsonField<WireTransferIntention> = JsonMissing.of(),
        ) : this(
            category,
            accountRevenuePayment,
            accountTransferIntention,
            achTransferIntention,
            achTransferRejection,
            achTransferReturn,
            blockchainOfframpTransferSettlement,
            blockchainOnrampTransferIntention,
            cardDisputeAcceptance,
            cardDisputeFinancial,
            cardDisputeLoss,
            cardFinancial,
            cardPushTransferAcceptance,
            cardRefund,
            cardRevenuePayment,
            cardSettlement,
            cashbackPayment,
            checkDepositAcceptance,
            checkDepositReturn,
            checkTransferDeposit,
            fednowTransferAcknowledgement,
            feePayment,
            inboundAchTransfer,
            inboundAchTransferReturnIntention,
            inboundCheckAdjustment,
            inboundCheckDepositReturnIntention,
            inboundFednowTransferConfirmation,
            inboundRealTimePaymentsTransferConfirmation,
            inboundWireReversal,
            inboundWireTransfer,
            inboundWireTransferReversal,
            interestPayment,
            internalSource,
            other,
            realTimePaymentsTransferAcknowledgement,
            sampleFunds,
            swiftTransferIntention,
            swiftTransferReturn,
            wireTransferIntention,
            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")

        /**
         * An Account Revenue Payment object. This field will be present in the JSON response if and
         * only if `category` is equal to `account_revenue_payment`. An Account Revenue Payment
         * represents a payment made to an account from the bank. Account revenue is a type of
         * non-interest income.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun accountRevenuePayment(): Optional<AccountRevenuePayment> =
            accountRevenuePayment.getOptional("account_revenue_payment")

        /**
         * An Account Transfer Intention object. This field will be present in the JSON response if
         * and only if `category` is equal to `account_transfer_intention`. Two Account Transfer
         * Intentions are created from each Account Transfer. One decrements the source account, and
         * the other increments the destination account.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun accountTransferIntention(): Optional<AccountTransferIntention> =
            accountTransferIntention.getOptional("account_transfer_intention")

        /**
         * An ACH Transfer Intention object. This field will be present in the JSON response if and
         * only if `category` is equal to `ach_transfer_intention`. An ACH Transfer Intention is
         * created from an ACH Transfer. It reflects the intention to move money into or out of an
         * Increase account via the ACH network.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun achTransferIntention(): Optional<AchTransferIntention> =
            achTransferIntention.getOptional("ach_transfer_intention")

        /**
         * An ACH Transfer Rejection object. This field will be present in the JSON response if and
         * only if `category` is equal to `ach_transfer_rejection`. An ACH Transfer Rejection is
         * created when an ACH Transfer is rejected by Increase. It offsets the ACH Transfer
         * Intention. These rejections are rare.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun achTransferRejection(): Optional<AchTransferRejection> =
            achTransferRejection.getOptional("ach_transfer_rejection")

        /**
         * An ACH Transfer Return object. This field will be present in the JSON response if and
         * only if `category` is equal to `ach_transfer_return`. An ACH Transfer Return is created
         * when an ACH Transfer is returned by the receiving bank. It offsets the ACH Transfer
         * Intention. ACH Transfer Returns usually occur within the first two business days after
         * the transfer is initiated, but can occur much later. The return appears as a new posted
         * Transaction; no Pending Transaction is created.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun achTransferReturn(): Optional<AchTransferReturn> =
            achTransferReturn.getOptional("ach_transfer_return")

        /**
         * A Blockchain Off-Ramp Transfer Settlement object. This field will be present in the JSON
         * response if and only if `category` is equal to `blockchain_offramp_transfer_settlement`.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun blockchainOfframpTransferSettlement(): Optional<BlockchainOfframpTransferSettlement> =
            blockchainOfframpTransferSettlement.getOptional(
                "blockchain_offramp_transfer_settlement"
            )

        /**
         * A Blockchain On-Ramp Transfer Intention object. This field will be present in the JSON
         * response if and only if `category` is equal to `blockchain_onramp_transfer_intention`.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun blockchainOnrampTransferIntention(): Optional<BlockchainOnrampTransferIntention> =
            blockchainOnrampTransferIntention.getOptional("blockchain_onramp_transfer_intention")

        /**
         * A Legacy Card Dispute Acceptance object. This field will be present in the JSON response
         * if and only if `category` is equal to `card_dispute_acceptance`. Contains the details of
         * a successful Card Dispute.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardDisputeAcceptance(): Optional<CardDisputeAcceptance> =
            cardDisputeAcceptance.getOptional("card_dispute_acceptance")

        /**
         * A Card Dispute Financial object. This field will be present in the JSON response if and
         * only if `category` is equal to `card_dispute_financial`. Financial event related to a
         * Card Dispute.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardDisputeFinancial(): Optional<CardDisputeFinancial> =
            cardDisputeFinancial.getOptional("card_dispute_financial")

        /**
         * A Legacy Card Dispute Loss object. This field will be present in the JSON response if and
         * only if `category` is equal to `card_dispute_loss`. Contains the details of a lost Card
         * Dispute.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardDisputeLoss(): Optional<CardDisputeLoss> =
            cardDisputeLoss.getOptional("card_dispute_loss")

        /**
         * 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 Push Transfer Acceptance object. This field will be present in the JSON response
         * if and only if `category` is equal to `card_push_transfer_acceptance`. A Card Push
         * Transfer Acceptance is created when an Outbound Card Push Transfer sent from Increase is
         * accepted by the receiving bank.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardPushTransferAcceptance(): Optional<CardPushTransferAcceptance> =
            cardPushTransferAcceptance.getOptional("card_push_transfer_acceptance")

        /**
         * 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 Revenue Payment object. This field will be present in the JSON response if and
         * only if `category` is equal to `card_revenue_payment`. Card Revenue Payments reflect
         * earnings from fees on card transactions.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cardRevenuePayment(): Optional<CardRevenuePayment> =
            cardRevenuePayment.getOptional("card_revenue_payment")

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

        /**
         * A Cashback Payment object. This field will be present in the JSON response if and only if
         * `category` is equal to `cashback_payment`. A Cashback Payment represents the cashback
         * paid to a cardholder for a given period. Cashback is usually paid monthly for the prior
         * month's transactions.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun cashbackPayment(): Optional<CashbackPayment> =
            cashbackPayment.getOptional("cashback_payment")

        /**
         * A Check Deposit Acceptance object. This field will be present in the JSON response if and
         * only if `category` is equal to `check_deposit_acceptance`. A Check Deposit Acceptance is
         * created when a Check Deposit is processed and its details confirmed. Check Deposits may
         * be returned by the receiving bank, which will appear as a Check Deposit Return.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun checkDepositAcceptance(): Optional<CheckDepositAcceptance> =
            checkDepositAcceptance.getOptional("check_deposit_acceptance")

        /**
         * A Check Deposit Return object. This field will be present in the JSON response if and
         * only if `category` is equal to `check_deposit_return`. A Check Deposit Return is created
         * when a Check Deposit is returned by the bank holding the account it was drawn against.
         * Check Deposits may be returned for a variety of reasons, including insufficient funds or
         * a mismatched account number. Usually, checks are returned within the first 7 days after
         * the deposit is made.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun checkDepositReturn(): Optional<CheckDepositReturn> =
            checkDepositReturn.getOptional("check_deposit_return")

        /**
         * A Check Transfer Deposit object. This field will be present in the JSON response if and
         * only if `category` is equal to `check_transfer_deposit`. An Inbound Check is a check
         * drawn on an Increase account that has been deposited by an external bank account. These
         * types of checks are not pre-registered.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun checkTransferDeposit(): Optional<CheckTransferDeposit> =
            checkTransferDeposit.getOptional("check_transfer_deposit")

        /**
         * A FedNow Transfer Acknowledgement object. This field will be present in the JSON response
         * if and only if `category` is equal to `fednow_transfer_acknowledgement`. A FedNow
         * Transfer Acknowledgement is created when a FedNow Transfer sent from Increase is
         * acknowledged by the receiving bank.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun fednowTransferAcknowledgement(): Optional<FednowTransferAcknowledgement> =
            fednowTransferAcknowledgement.getOptional("fednow_transfer_acknowledgement")

        /**
         * A Fee Payment object. This field will be present in the JSON response if and only if
         * `category` is equal to `fee_payment`. A Fee Payment represents a payment made to
         * Increase.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun feePayment(): Optional<FeePayment> = feePayment.getOptional("fee_payment")

        /**
         * An Inbound ACH Transfer Intention object. This field will be present in the JSON response
         * if and only if `category` is equal to `inbound_ach_transfer`. An Inbound ACH Transfer
         * Intention is created when an ACH transfer is initiated at another bank and received by
         * Increase.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun inboundAchTransfer(): Optional<InboundAchTransfer> =
            inboundAchTransfer.getOptional("inbound_ach_transfer")

        /**
         * An Inbound ACH Transfer Return Intention object. This field will be present in the JSON
         * response if and only if `category` is equal to `inbound_ach_transfer_return_intention`.
         * An Inbound ACH Transfer Return Intention is created when an ACH transfer is initiated at
         * another bank and returned by Increase.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun inboundAchTransferReturnIntention(): Optional<InboundAchTransferReturnIntention> =
            inboundAchTransferReturnIntention.getOptional("inbound_ach_transfer_return_intention")

        /**
         * An Inbound Check Adjustment object. This field will be present in the JSON response if
         * and only if `category` is equal to `inbound_check_adjustment`. An Inbound Check
         * Adjustment is created when Increase receives an adjustment for a check or return
         * deposited through Check21.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun inboundCheckAdjustment(): Optional<InboundCheckAdjustment> =
            inboundCheckAdjustment.getOptional("inbound_check_adjustment")

        /**
         * An Inbound Check Deposit Return Intention object. This field will be present in the JSON
         * response if and only if `category` is equal to `inbound_check_deposit_return_intention`.
         * An Inbound Check Deposit Return Intention is created when Increase receives an Inbound
         * Check and the User requests that it be returned.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun inboundCheckDepositReturnIntention(): Optional<InboundCheckDepositReturnIntention> =
            inboundCheckDepositReturnIntention.getOptional("inbound_check_deposit_return_intention")

        /**
         * An Inbound FedNow Transfer Confirmation object. This field will be present in the JSON
         * response if and only if `category` is equal to `inbound_fednow_transfer_confirmation`. An
         * Inbound FedNow Transfer Confirmation is created when a FedNow transfer is initiated at
         * another bank and received by Increase.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun inboundFednowTransferConfirmation(): Optional<InboundFednowTransferConfirmation> =
            inboundFednowTransferConfirmation.getOptional("inbound_fednow_transfer_confirmation")

        /**
         * An Inbound Real-Time Payments Transfer Confirmation object. This field will be present in
         * the JSON response if and only if `category` is equal to
         * `inbound_real_time_payments_transfer_confirmation`. An Inbound Real-Time Payments
         * Transfer Confirmation is created when a Real-Time Payments transfer is initiated at
         * another bank and received by Increase.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun inboundRealTimePaymentsTransferConfirmation():
            Optional<InboundRealTimePaymentsTransferConfirmation> =
            inboundRealTimePaymentsTransferConfirmation.getOptional(
                "inbound_real_time_payments_transfer_confirmation"
            )

        /**
         * An Inbound Wire Reversal object. This field will be present in the JSON response if and
         * only if `category` is equal to `inbound_wire_reversal`. An Inbound Wire Reversal
         * represents a reversal of a wire transfer that was initiated via Increase. The other bank
         * is sending the money back. This most often happens when the original destination account
         * details were incorrect.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun inboundWireReversal(): Optional<InboundWireReversal> =
            inboundWireReversal.getOptional("inbound_wire_reversal")

        /**
         * An Inbound Wire Transfer Intention object. This field will be present in the JSON
         * response if and only if `category` is equal to `inbound_wire_transfer`. An Inbound Wire
         * Transfer Intention is created when a wire transfer is initiated at another bank and
         * received by Increase.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun inboundWireTransfer(): Optional<InboundWireTransfer> =
            inboundWireTransfer.getOptional("inbound_wire_transfer")

        /**
         * An Inbound Wire Transfer Reversal Intention object. This field will be present in the
         * JSON response if and only if `category` is equal to `inbound_wire_transfer_reversal`. An
         * Inbound Wire Transfer Reversal Intention is created when Increase has received a wire and
         * the User requests that it be reversed.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun inboundWireTransferReversal(): Optional<InboundWireTransferReversal> =
            inboundWireTransferReversal.getOptional("inbound_wire_transfer_reversal")

        /**
         * An Interest Payment object. This field will be present in the JSON response if and only
         * if `category` is equal to `interest_payment`. An Interest Payment represents a payment of
         * interest on an account. Interest is usually paid monthly.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun interestPayment(): Optional<InterestPayment> =
            interestPayment.getOptional("interest_payment")

        /**
         * An Internal Source object. This field will be present in the JSON response if and only if
         * `category` is equal to `internal_source`. A transaction between the user and Increase.
         * See the `reason` attribute for more information.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun internalSource(): Optional<InternalSource> =
            internalSource.getOptional("internal_source")

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

        /**
         * A Real-Time Payments Transfer Acknowledgement object. This field will be present in the
         * JSON response if and only if `category` is equal to
         * `real_time_payments_transfer_acknowledgement`. A Real-Time Payments Transfer
         * Acknowledgement is created when a Real-Time Payments Transfer sent from Increase is
         * acknowledged by the receiving bank.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun realTimePaymentsTransferAcknowledgement():
            Optional<RealTimePaymentsTransferAcknowledgement> =
            realTimePaymentsTransferAcknowledgement.getOptional(
                "real_time_payments_transfer_acknowledgement"
            )

        /**
         * A Sample Funds object. This field will be present in the JSON response if and only if
         * `category` is equal to `sample_funds`. Sample funds for testing purposes.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun sampleFunds(): Optional<SampleFunds> = sampleFunds.getOptional("sample_funds")

        /**
         * A Swift Transfer Intention object. This field will be present in the JSON response if and
         * only if `category` is equal to `swift_transfer_intention`. A Swift Transfer initiated via
         * Increase.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun swiftTransferIntention(): Optional<SwiftTransferIntention> =
            swiftTransferIntention.getOptional("swift_transfer_intention")

        /**
         * A Swift Transfer Return object. This field will be present in the JSON response if and
         * only if `category` is equal to `swift_transfer_return`. A Swift Transfer Return is
         * created when a Swift Transfer is returned by the receiving bank.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun swiftTransferReturn(): Optional<SwiftTransferReturn> =
            swiftTransferReturn.getOptional("swift_transfer_return")

        /**
         * A Wire Transfer Intention object. This field will be present in the JSON response if and
         * only if `category` is equal to `wire_transfer_intention`. A Wire Transfer initiated via
         * Increase and sent to a different bank.
         *
         * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
         *   the server responded with an unexpected value).
         */
        fun wireTransferIntention(): Optional<WireTransferIntention> =
            wireTransferIntention.getOptional("wire_transfer_intention")

        /**
         * 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 [accountRevenuePayment].
         *
         * Unlike [accountRevenuePayment], this method doesn't throw if the JSON field has an
         * unexpected type.
         */
        @JsonProperty("account_revenue_payment")
        @ExcludeMissing
        fun _accountRevenuePayment(): JsonField<AccountRevenuePayment> = accountRevenuePayment

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

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

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

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

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

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

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

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

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

        /**
         * 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 [cardPushTransferAcceptance].
         *
         * Unlike [cardPushTransferAcceptance], this method doesn't throw if the JSON field has an
         * unexpected type.
         */
        @JsonProperty("card_push_transfer_acceptance")
        @ExcludeMissing
        fun _cardPushTransferAcceptance(): JsonField<CardPushTransferAcceptance> =
            cardPushTransferAcceptance

        /**
         * 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 [cardRevenuePayment].
         *
         * Unlike [cardRevenuePayment], this method doesn't throw if the JSON field has an
         * unexpected type.
         */
        @JsonProperty("card_revenue_payment")
        @ExcludeMissing
        fun _cardRevenuePayment(): JsonField<CardRevenuePayment> = cardRevenuePayment

        /**
         * 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 [cashbackPayment].
         *
         * Unlike [cashbackPayment], this method doesn't throw if the JSON field has an unexpected
         * type.
         */
        @JsonProperty("cashback_payment")
        @ExcludeMissing
        fun _cashbackPayment(): JsonField<CashbackPayment> = cashbackPayment

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        @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 [Source].
             *
             * The following fields are required:
             * ```java
             * .category()
             * ```
             */
            @JvmStatic fun builder() = Builder()
        }

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

            private var category: JsonField<Category>? = null
            private var accountRevenuePayment: JsonField<AccountRevenuePayment> = JsonMissing.of()
            private var accountTransferIntention: JsonField<AccountTransferIntention> =
                JsonMissing.of()
            private var achTransferIntention: JsonField<AchTransferIntention> = JsonMissing.of()
            private var achTransferRejection: JsonField<AchTransferRejection> = JsonMissing.of()
            private var achTransferReturn: JsonField<AchTransferReturn> = JsonMissing.of()
            private var blockchainOfframpTransferSettlement:
                JsonField<BlockchainOfframpTransferSettlement> =
                JsonMissing.of()
            private var blockchainOnrampTransferIntention:
                JsonField<BlockchainOnrampTransferIntention> =
                JsonMissing.of()
            private var cardDisputeAcceptance: JsonField<CardDisputeAcceptance> = JsonMissing.of()
            private var cardDisputeFinancial: JsonField<CardDisputeFinancial> = JsonMissing.of()
            private var cardDisputeLoss: JsonField<CardDisputeLoss> = JsonMissing.of()
            private var cardFinancial: JsonField<CardFinancial> = JsonMissing.of()
            private var cardPushTransferAcceptance: JsonField<CardPushTransferAcceptance> =
                JsonMissing.of()
            private var cardRefund: JsonField<CardRefund> = JsonMissing.of()
            private var cardRevenuePayment: JsonField<CardRevenuePayment> = JsonMissing.of()
            private var cardSettlement: JsonField<CardSettlement> = JsonMissing.of()
            private var cashbackPayment: JsonField<CashbackPayment> = JsonMissing.of()
            private var checkDepositAcceptance: JsonField<CheckDepositAcceptance> = JsonMissing.of()
            private var checkDepositReturn: JsonField<CheckDepositReturn> = JsonMissing.of()
            private var checkTransferDeposit: JsonField<CheckTransferDeposit> = JsonMissing.of()
            private var fednowTransferAcknowledgement: JsonField<FednowTransferAcknowledgement> =
                JsonMissing.of()
            private var feePayment: JsonField<FeePayment> = JsonMissing.of()
            private var inboundAchTransfer: JsonField<InboundAchTransfer> = JsonMissing.of()
            private var inboundAchTransferReturnIntention:
                JsonField<InboundAchTransferReturnIntention> =
                JsonMissing.of()
            private var inboundCheckAdjustment: JsonField<InboundCheckAdjustment> = JsonMissing.of()
            private var inboundCheckDepositReturnIntention:
                JsonField<InboundCheckDepositReturnIntention> =
                JsonMissing.of()
            private var inboundFednowTransferConfirmation:
                JsonField<InboundFednowTransferConfirmation> =
                JsonMissing.of()
            private var inboundRealTimePaymentsTransferConfirmation:
                JsonField<InboundRealTimePaymentsTransferConfirmation> =
                JsonMissing.of()
            private var inboundWireReversal: JsonField<InboundWireReversal> = JsonMissing.of()
            private var inboundWireTransfer: JsonField<InboundWireTransfer> = JsonMissing.of()
            private var inboundWireTransferReversal: JsonField<InboundWireTransferReversal> =
                JsonMissing.of()
            private var interestPayment: JsonField<InterestPayment> = JsonMissing.of()
            private var internalSource: JsonField<InternalSource> = JsonMissing.of()
            private var other: JsonField<Other> = JsonMissing.of()
            private var realTimePaymentsTransferAcknowledgement:
                JsonField<RealTimePaymentsTransferAcknowledgement> =
                JsonMissing.of()
            private var sampleFunds: JsonField<SampleFunds> = JsonMissing.of()
            private var swiftTransferIntention: JsonField<SwiftTransferIntention> = JsonMissing.of()
            private var swiftTransferReturn: JsonField<SwiftTransferReturn> = JsonMissing.of()
            private var wireTransferIntention: JsonField<WireTransferIntention> = JsonMissing.of()
            private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

            @JvmSynthetic
            internal fun from(source: Source) = apply {
                category = source.category
                accountRevenuePayment = source.accountRevenuePayment
                accountTransferIntention = source.accountTransferIntention
                achTransferIntention = source.achTransferIntention
                achTransferRejection = source.achTransferRejection
                achTransferReturn = source.achTransferReturn
                blockchainOfframpTransferSettlement = source.blockchainOfframpTransferSettlement
                blockchainOnrampTransferIntention = source.blockchainOnrampTransferIntention
                cardDisputeAcceptance = source.cardDisputeAcceptance
                cardDisputeFinancial = source.cardDisputeFinancial
                cardDisputeLoss = source.cardDisputeLoss
                cardFinancial = source.cardFinancial
                cardPushTransferAcceptance = source.cardPushTransferAcceptance
                cardRefund = source.cardRefund
                cardRevenuePayment = source.cardRevenuePayment
                cardSettlement = source.cardSettlement
                cashbackPayment = source.cashbackPayment
                checkDepositAcceptance = source.checkDepositAcceptance
                checkDepositReturn = source.checkDepositReturn
                checkTransferDeposit = source.checkTransferDeposit
                fednowTransferAcknowledgement = source.fednowTransferAcknowledgement
                feePayment = source.feePayment
                inboundAchTransfer = source.inboundAchTransfer
                inboundAchTransferReturnIntention = source.inboundAchTransferReturnIntention
                inboundCheckAdjustment = source.inboundCheckAdjustment
                inboundCheckDepositReturnIntention = source.inboundCheckDepositReturnIntention
                inboundFednowTransferConfirmation = source.inboundFednowTransferConfirmation
                inboundRealTimePaymentsTransferConfirmation =
                    source.inboundRealTimePaymentsTransferConfirmation
                inboundWireReversal = source.inboundWireReversal
                inboundWireTransfer = source.inboundWireTransfer
                inboundWireTransferReversal = source.inboundWireTransferReversal
                interestPayment = source.interestPayment
                internalSource = source.internalSource
                other = source.other
                realTimePaymentsTransferAcknowledgement =
                    source.realTimePaymentsTransferAcknowledgement
                sampleFunds = source.sampleFunds
                swiftTransferIntention = source.swiftTransferIntention
                swiftTransferReturn = source.swiftTransferReturn
                wireTransferIntention = source.wireTransferIntention
                additionalProperties = source.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 }

            /**
             * An Account Revenue Payment object. This field will be present in the JSON response if
             * and only if `category` is equal to `account_revenue_payment`. An Account Revenue
             * Payment represents a payment made to an account from the bank. Account revenue is a
             * type of non-interest income.
             */
            fun accountRevenuePayment(accountRevenuePayment: AccountRevenuePayment?) =
                accountRevenuePayment(JsonField.ofNullable(accountRevenuePayment))

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

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

            /**
             * An Account Transfer Intention object. This field will be present in the JSON response
             * if and only if `category` is equal to `account_transfer_intention`. Two Account
             * Transfer Intentions are created from each Account Transfer. One decrements the source
             * account, and the other increments the destination account.
             */
            fun accountTransferIntention(accountTransferIntention: AccountTransferIntention?) =
                accountTransferIntention(JsonField.ofNullable(accountTransferIntention))

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

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

            /**
             * An ACH Transfer Intention object. This field will be present in the JSON response if
             * and only if `category` is equal to `ach_transfer_intention`. An ACH Transfer
             * Intention is created from an ACH Transfer. It reflects the intention to move money
             * into or out of an Increase account via the ACH network.
             */
            fun achTransferIntention(achTransferIntention: AchTransferIntention?) =
                achTransferIntention(JsonField.ofNullable(achTransferIntention))

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

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

            /**
             * An ACH Transfer Rejection object. This field will be present in the JSON response if
             * and only if `category` is equal to `ach_transfer_rejection`. An ACH Transfer
             * Rejection is created when an ACH Transfer is rejected by Increase. It offsets the ACH
             * Transfer Intention. These rejections are rare.
             */
            fun achTransferRejection(achTransferRejection: AchTransferRejection?) =
                achTransferRejection(JsonField.ofNullable(achTransferRejection))

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

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

            /**
             * An ACH Transfer Return object. This field will be present in the JSON response if and
             * only if `category` is equal to `ach_transfer_return`. An ACH Transfer Return is
             * created when an ACH Transfer is returned by the receiving bank. It offsets the ACH
             * Transfer Intention. ACH Transfer Returns usually occur within the first two business
             * days after the transfer is initiated, but can occur much later. The return appears as
             * a new posted Transaction; no Pending Transaction is created.
             */
            fun achTransferReturn(achTransferReturn: AchTransferReturn?) =
                achTransferReturn(JsonField.ofNullable(achTransferReturn))

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

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

            /**
             * A Blockchain Off-Ramp Transfer Settlement object. This field will be present in the
             * JSON response if and only if `category` is equal to
             * `blockchain_offramp_transfer_settlement`.
             */
            fun blockchainOfframpTransferSettlement(
                blockchainOfframpTransferSettlement: BlockchainOfframpTransferSettlement?
            ) =
                blockchainOfframpTransferSettlement(
                    JsonField.ofNullable(blockchainOfframpTransferSettlement)
                )

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

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

            /**
             * A Blockchain On-Ramp Transfer Intention object. This field will be present in the
             * JSON response if and only if `category` is equal to
             * `blockchain_onramp_transfer_intention`.
             */
            fun blockchainOnrampTransferIntention(
                blockchainOnrampTransferIntention: BlockchainOnrampTransferIntention?
            ) =
                blockchainOnrampTransferIntention(
                    JsonField.ofNullable(blockchainOnrampTransferIntention)
                )

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

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

            /**
             * A Legacy Card Dispute Acceptance object. This field will be present in the JSON
             * response if and only if `category` is equal to `card_dispute_acceptance`. Contains
             * the details of a successful Card Dispute.
             */
            fun cardDisputeAcceptance(cardDisputeAcceptance: CardDisputeAcceptance?) =
                cardDisputeAcceptance(JsonField.ofNullable(cardDisputeAcceptance))

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

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

            /**
             * A Card Dispute Financial object. This field will be present in the JSON response if
             * and only if `category` is equal to `card_dispute_financial`. Financial event related
             * to a Card Dispute.
             */
            fun cardDisputeFinancial(cardDisputeFinancial: CardDisputeFinancial?) =
                cardDisputeFinancial(JsonField.ofNullable(cardDisputeFinancial))

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

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

            /**
             * A Legacy Card Dispute Loss object. This field will be present in the JSON response if
             * and only if `category` is equal to `card_dispute_loss`. Contains the details of a
             * lost Card Dispute.
             */
            fun cardDisputeLoss(cardDisputeLoss: CardDisputeLoss?) =
                cardDisputeLoss(JsonField.ofNullable(cardDisputeLoss))

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

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

            /**
             * 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 Push Transfer Acceptance object. This field will be present in the JSON
             * response if and only if `category` is equal to `card_push_transfer_acceptance`. A
             * Card Push Transfer Acceptance is created when an Outbound Card Push Transfer sent
             * from Increase is accepted by the receiving bank.
             */
            fun cardPushTransferAcceptance(
                cardPushTransferAcceptance: CardPushTransferAcceptance?
            ) = cardPushTransferAcceptance(JsonField.ofNullable(cardPushTransferAcceptance))

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

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

            /**
             * 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 Revenue Payment object. This field will be present in the JSON response if and
             * only if `category` is equal to `card_revenue_payment`. Card Revenue Payments reflect
             * earnings from fees on card transactions.
             */
            fun cardRevenuePayment(cardRevenuePayment: CardRevenuePayment?) =
                cardRevenuePayment(JsonField.ofNullable(cardRevenuePayment))

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

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

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

            /**
             * A Cashback Payment object. This field will be present in the JSON response if and
             * only if `category` is equal to `cashback_payment`. A Cashback Payment represents the
             * cashback paid to a cardholder for a given period. Cashback is usually paid monthly
             * for the prior month's transactions.
             */
            fun cashbackPayment(cashbackPayment: CashbackPayment?) =
                cashbackPayment(JsonField.ofNullable(cashbackPayment))

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

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

            /**
             * A Check Deposit Acceptance object. This field will be present in the JSON response if
             * and only if `category` is equal to `check_deposit_acceptance`. A Check Deposit
             * Acceptance is created when a Check Deposit is processed and its details confirmed.
             * Check Deposits may be returned by the receiving bank, which will appear as a Check
             * Deposit Return.
             */
            fun checkDepositAcceptance(checkDepositAcceptance: CheckDepositAcceptance?) =
                checkDepositAcceptance(JsonField.ofNullable(checkDepositAcceptance))

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

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

            /**
             * A Check Deposit Return object. This field will be present in the JSON response if and
             * only if `category` is equal to `check_deposit_return`. A Check Deposit Return is
             * created when a Check Deposit is returned by the bank holding the account it was drawn
             * against. Check Deposits may be returned for a variety of reasons, including
             * insufficient funds or a mismatched account number. Usually, checks are returned
             * within the first 7 days after the deposit is made.
             */
            fun checkDepositReturn(checkDepositReturn: CheckDepositReturn?) =
                checkDepositReturn(JsonField.ofNullable(checkDepositReturn))

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

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

            /**
             * A Check Transfer Deposit object. This field will be present in the JSON response if
             * and only if `category` is equal to `check_transfer_deposit`. An Inbound Check is a
             * check drawn on an Increase account that has been deposited by an external bank
             * account. These types of checks are not pre-registered.
             */
            fun checkTransferDeposit(checkTransferDeposit: CheckTransferDeposit?) =
                checkTransferDeposit(JsonField.ofNullable(checkTransferDeposit))

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

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

            /**
             * A FedNow Transfer Acknowledgement object. This field will be present in the JSON
             * response if and only if `category` is equal to `fednow_transfer_acknowledgement`. A
             * FedNow Transfer Acknowledgement is created when a FedNow Transfer sent from Increase
             * is acknowledged by the receiving bank.
             */
            fun fednowTransferAcknowledgement(
                fednowTransferAcknowledgement: FednowTransferAcknowledgement?
            ) = fednowTransferAcknowledgement(JsonField.ofNullable(fednowTransferAcknowledgement))

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

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

            /**
             * A Fee Payment object. This field will be present in the JSON response if and only if
             * `category` is equal to `fee_payment`. A Fee Payment represents a payment made to
             * Increase.
             */
            fun feePayment(feePayment: FeePayment?) = feePayment(JsonField.ofNullable(feePayment))

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

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

            /**
             * An Inbound ACH Transfer Intention object. This field will be present in the JSON
             * response if and only if `category` is equal to `inbound_ach_transfer`. An Inbound ACH
             * Transfer Intention is created when an ACH transfer is initiated at another bank and
             * received by Increase.
             */
            fun inboundAchTransfer(inboundAchTransfer: InboundAchTransfer?) =
                inboundAchTransfer(JsonField.ofNullable(inboundAchTransfer))

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

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

            /**
             * An Inbound ACH Transfer Return Intention object. This field will be present in the
             * JSON response if and only if `category` is equal to
             * `inbound_ach_transfer_return_intention`. An Inbound ACH Transfer Return Intention is
             * created when an ACH transfer is initiated at another bank and returned by Increase.
             */
            fun inboundAchTransferReturnIntention(
                inboundAchTransferReturnIntention: InboundAchTransferReturnIntention?
            ) =
                inboundAchTransferReturnIntention(
                    JsonField.ofNullable(inboundAchTransferReturnIntention)
                )

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

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

            /**
             * An Inbound Check Adjustment object. This field will be present in the JSON response
             * if and only if `category` is equal to `inbound_check_adjustment`. An Inbound Check
             * Adjustment is created when Increase receives an adjustment for a check or return
             * deposited through Check21.
             */
            fun inboundCheckAdjustment(inboundCheckAdjustment: InboundCheckAdjustment?) =
                inboundCheckAdjustment(JsonField.ofNullable(inboundCheckAdjustment))

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

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

            /**
             * An Inbound Check Deposit Return Intention object. This field will be present in the
             * JSON response if and only if `category` is equal to
             * `inbound_check_deposit_return_intention`. An Inbound Check Deposit Return Intention
             * is created when Increase receives an Inbound Check and the User requests that it be
             * returned.
             */
            fun inboundCheckDepositReturnIntention(
                inboundCheckDepositReturnIntention: InboundCheckDepositReturnIntention?
            ) =
                inboundCheckDepositReturnIntention(
                    JsonField.ofNullable(inboundCheckDepositReturnIntention)
                )

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

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

            /**
             * An Inbound FedNow Transfer Confirmation object. This field will be present in the
             * JSON response if and only if `category` is equal to
             * `inbound_fednow_transfer_confirmation`. An Inbound FedNow Transfer Confirmation is
             * created when a FedNow transfer is initiated at another bank and received by Increase.
             */
            fun inboundFednowTransferConfirmation(
                inboundFednowTransferConfirmation: InboundFednowTransferConfirmation?
            ) =
                inboundFednowTransferConfirmation(
                    JsonField.ofNullable(inboundFednowTransferConfirmation)
                )

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

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

            /**
             * An Inbound Real-Time Payments Transfer Confirmation object. This field will be
             * present in the JSON response if and only if `category` is equal to
             * `inbound_real_time_payments_transfer_confirmation`. An Inbound Real-Time Payments
             * Transfer Confirmation is created when a Real-Time Payments transfer is initiated at
             * another bank and received by Increase.
             */
            fun inboundRealTimePaymentsTransferConfirmation(
                inboundRealTimePaymentsTransferConfirmation:
                    InboundRealTimePaymentsTransferConfirmation?
            ) =
                inboundRealTimePaymentsTransferConfirmation(
                    JsonField.ofNullable(inboundRealTimePaymentsTransferConfirmation)
                )

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

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

            /**
             * An Inbound Wire Reversal object. This field will be present in the JSON response if
             * and only if `category` is equal to `inbound_wire_reversal`. An Inbound Wire Reversal
             * represents a reversal of a wire transfer that was initiated via Increase. The other
             * bank is sending the money back. This most often happens when the original destination
             * account details were incorrect.
             */
            fun inboundWireReversal(inboundWireReversal: InboundWireReversal?) =
                inboundWireReversal(JsonField.ofNullable(inboundWireReversal))

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

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

            /**
             * An Inbound Wire Transfer Intention object. This field will be present in the JSON
             * response if and only if `category` is equal to `inbound_wire_transfer`. An Inbound
             * Wire Transfer Intention is created when a wire transfer is initiated at another bank
             * and received by Increase.
             */
            fun inboundWireTransfer(inboundWireTransfer: InboundWireTransfer?) =
                inboundWireTransfer(JsonField.ofNullable(inboundWireTransfer))

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

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

            /**
             * An Inbound Wire Transfer Reversal Intention object. This field will be present in the
             * JSON response if and only if `category` is equal to `inbound_wire_transfer_reversal`.
             * An Inbound Wire Transfer Reversal Intention is created when Increase has received a
             * wire and the User requests that it be reversed.
             */
            fun inboundWireTransferReversal(
                inboundWireTransferReversal: InboundWireTransferReversal?
            ) = inboundWireTransferReversal(JsonField.ofNullable(inboundWireTransferReversal))

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

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

            /**
             * An Interest Payment object. This field will be present in the JSON response if and
             * only if `category` is equal to `interest_payment`. An Interest Payment represents a
             * payment of interest on an account. Interest is usually paid monthly.
             */
            fun interestPayment(interestPayment: InterestPayment?) =
                interestPayment(JsonField.ofNullable(interestPayment))

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

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

            /**
             * An Internal Source object. This field will be present in the JSON response if and
             * only if `category` is equal to `internal_source`. A transaction between the user and
             * Increase. See the `reason` attribute for more information.
             */
            fun internalSource(internalSource: InternalSource?) =
                internalSource(JsonField.ofNullable(internalSource))

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

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

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

            /**
             * A Real-Time Payments Transfer Acknowledgement object. This field will be present in
             * the JSON response if and only if `category` is equal to
             * `real_time_payments_transfer_acknowledgement`. A Real-Time Payments Transfer
             * Acknowledgement is created when a Real-Time Payments Transfer sent from Increase is
             * acknowledged by the receiving bank.
             */
            fun realTimePaymentsTransferAcknowledgement(
                realTimePaymentsTransferAcknowledgement: RealTimePaymentsTransferAcknowledgement?
            ) =
                realTimePaymentsTransferAcknowledgement(
                    JsonField.ofNullable(realTimePaymentsTransferAcknowledgement)
                )

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

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

            /**
             * A Sample Funds object. This field will be present in the JSON response if and only if
             * `category` is equal to `sample_funds`. Sample funds for testing purposes.
             */
            fun sampleFunds(sampleFunds: SampleFunds?) =
                sampleFunds(JsonField.ofNullable(sampleFunds))

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

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

            /**
             * A Swift Transfer Intention object. This field will be present in the JSON response if
             * and only if `category` is equal to `swift_transfer_intention`. A Swift Transfer
             * initiated via Increase.
             */
            fun swiftTransferIntention(swiftTransferIntention: SwiftTransferIntention?) =
                swiftTransferIntention(JsonField.ofNullable(swiftTransferIntention))

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

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

            /**
             * A Swift Transfer Return object. This field will be present in the JSON response if
             * and only if `category` is equal to `swift_transfer_return`. A Swift Transfer Return
             * is created when a Swift Transfer is returned by the receiving bank.
             */
            fun swiftTransferReturn(swiftTransferReturn: SwiftTransferReturn?) =
                swiftTransferReturn(JsonField.ofNullable(swiftTransferReturn))

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

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

            /**
             * A Wire Transfer Intention object. This field will be present in the JSON response if
             * and only if `category` is equal to `wire_transfer_intention`. A Wire Transfer
             * initiated via Increase and sent to a different bank.
             */
            fun wireTransferIntention(wireTransferIntention: WireTransferIntention?) =
                wireTransferIntention(JsonField.ofNullable(wireTransferIntention))

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

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

            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 [Source].
             *
             * Further updates to this [Builder] will not mutate the returned instance.
             *
             * The following fields are required:
             * ```java
             * .category()
             * ```
             *
             * @throws IllegalStateException if any required field is unset.
             */
            fun build(): Source =
                Source(
                    checkRequired("category", category),
                    accountRevenuePayment,
                    accountTransferIntention,
                    achTransferIntention,
                    achTransferRejection,
                    achTransferReturn,
                    blockchainOfframpTransferSettlement,
                    blockchainOnrampTransferIntention,
                    cardDisputeAcceptance,
                    cardDisputeFinancial,
                    cardDisputeLoss,
                    cardFinancial,
                    cardPushTransferAcceptance,
                    cardRefund,
                    cardRevenuePayment,
                    cardSettlement,
                    cashbackPayment,
                    checkDepositAcceptance,
                    checkDepositReturn,
                    checkTransferDeposit,
                    fednowTransferAcknowledgement,
                    feePayment,
                    inboundAchTransfer,
                    inboundAchTransferReturnIntention,
                    inboundCheckAdjustment,
                    inboundCheckDepositReturnIntention,
                    inboundFednowTransferConfirmation,
                    inboundRealTimePaymentsTransferConfirmation,
                    inboundWireReversal,
                    inboundWireTransfer,
                    inboundWireTransferReversal,
                    interestPayment,
                    internalSource,
                    other,
                    realTimePaymentsTransferAcknowledgement,
                    sampleFunds,
                    swiftTransferIntention,
                    swiftTransferReturn,
                    wireTransferIntention,
                    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(): Source = apply {
            if (validated) {
                return@apply
            }

            category().validate()
            accountRevenuePayment().ifPresent { it.validate() }
            accountTransferIntention().ifPresent { it.validate() }
            achTransferIntention().ifPresent { it.validate() }
            achTransferRejection().ifPresent { it.validate() }
            achTransferReturn().ifPresent { it.validate() }
            blockchainOfframpTransferSettlement().ifPresent { it.validate() }
            blockchainOnrampTransferIntention().ifPresent { it.validate() }
            cardDisputeAcceptance().ifPresent { it.validate() }
            cardDisputeFinancial().ifPresent { it.validate() }
            cardDisputeLoss().ifPresent { it.validate() }
            cardFinancial().ifPresent { it.validate() }
            cardPushTransferAcceptance().ifPresent { it.validate() }
            cardRefund().ifPresent { it.validate() }
            cardRevenuePayment().ifPresent { it.validate() }
            cardSettlement().ifPresent { it.validate() }
            cashbackPayment().ifPresent { it.validate() }
            checkDepositAcceptance().ifPresent { it.validate() }
            checkDepositReturn().ifPresent { it.validate() }
            checkTransferDeposit().ifPresent { it.validate() }
            fednowTransferAcknowledgement().ifPresent { it.validate() }
            feePayment().ifPresent { it.validate() }
            inboundAchTransfer().ifPresent { it.validate() }
            inboundAchTransferReturnIntention().ifPresent { it.validate() }
            inboundCheckAdjustment().ifPresent { it.validate() }
            inboundCheckDepositReturnIntention().ifPresent { it.validate() }
            inboundFednowTransferConfirmation().ifPresent { it.validate() }
            inboundRealTimePaymentsTransferConfirmation().ifPresent { it.validate() }
            inboundWireReversal().ifPresent { it.validate() }
            inboundWireTransfer().ifPresent { it.validate() }
            inboundWireTransferReversal().ifPresent { it.validate() }
            interestPayment().ifPresent { it.validate() }
            internalSource().ifPresent { it.validate() }
            other().ifPresent { it.validate() }
            realTimePaymentsTransferAcknowledgement().ifPresent { it.validate() }
            sampleFunds().ifPresent { it.validate() }
            swiftTransferIntention().ifPresent { it.validate() }
            swiftTransferReturn().ifPresent { it.validate() }
            wireTransferIntention().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) +
                (accountRevenuePayment.asKnown().getOrNull()?.validity() ?: 0) +
                (accountTransferIntention.asKnown().getOrNull()?.validity() ?: 0) +
                (achTransferIntention.asKnown().getOrNull()?.validity() ?: 0) +
                (achTransferRejection.asKnown().getOrNull()?.validity() ?: 0) +
                (achTransferReturn.asKnown().getOrNull()?.validity() ?: 0) +
                (blockchainOfframpTransferSettlement.asKnown().getOrNull()?.validity() ?: 0) +
                (blockchainOnrampTransferIntention.asKnown().getOrNull()?.validity() ?: 0) +
                (cardDisputeAcceptance.asKnown().getOrNull()?.validity() ?: 0) +
                (cardDisputeFinancial.asKnown().getOrNull()?.validity() ?: 0) +
                (cardDisputeLoss.asKnown().getOrNull()?.validity() ?: 0) +
                (cardFinancial.asKnown().getOrNull()?.validity() ?: 0) +
                (cardPushTransferAcceptance.asKnown().getOrNull()?.validity() ?: 0) +
                (cardRefund.asKnown().getOrNull()?.validity() ?: 0) +
                (cardRevenuePayment.asKnown().getOrNull()?.validity() ?: 0) +
                (cardSettlement.asKnown().getOrNull()?.validity() ?: 0) +
                (cashbackPayment.asKnown().getOrNull()?.validity() ?: 0) +
                (checkDepositAcceptance.asKnown().getOrNull()?.validity() ?: 0) +
                (checkDepositReturn.asKnown().getOrNull()?.validity() ?: 0) +
                (checkTransferDeposit.asKnown().getOrNull()?.validity() ?: 0) +
                (fednowTransferAcknowledgement.asKnown().getOrNull()?.validity() ?: 0) +
                (feePayment.asKnown().getOrNull()?.validity() ?: 0) +
                (inboundAchTransfer.asKnown().getOrNull()?.validity() ?: 0) +
                (inboundAchTransferReturnIntention.asKnown().getOrNull()?.validity() ?: 0) +
                (inboundCheckAdjustment.asKnown().getOrNull()?.validity() ?: 0) +
                (inboundCheckDepositReturnIntention.asKnown().getOrNull()?.validity() ?: 0) +
                (inboundFednowTransferConfirmation.asKnown().getOrNull()?.validity() ?: 0) +
                (inboundRealTimePaymentsTransferConfirmation.asKnown().getOrNull()?.validity()
                    ?: 0) +
                (inboundWireReversal.asKnown().getOrNull()?.validity() ?: 0) +
                (inboundWireTransfer.asKnown().getOrNull()?.validity() ?: 0) +
                (inboundWireTransferReversal.asKnown().getOrNull()?.validity() ?: 0) +
                (interestPayment.asKnown().getOrNull()?.validity() ?: 0) +
                (internalSource.asKnown().getOrNull()?.validity() ?: 0) +
                (other.asKnown().getOrNull()?.validity() ?: 0) +
                (realTimePaymentsTransferAcknowledgement.asKnown().getOrNull()?.validity() ?: 0) +
                (sampleFunds.asKnown().getOrNull()?.validity() ?: 0) +
                (swiftTransferIntention.asKnown().getOrNull()?.validity() ?: 0) +
                (swiftTransferReturn.asKnown().getOrNull()?.validity() ?: 0) +
                (wireTransferIntention.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 {

                /**
                 * Account Transfer Intention: details will be under the
                 * `account_transfer_intention` object.
                 */
                @JvmField val ACCOUNT_TRANSFER_INTENTION = of("account_transfer_intention")

                /**
                 * ACH Transfer Intention: details will be under the `ach_transfer_intention`
                 * object.
                 */
                @JvmField val ACH_TRANSFER_INTENTION = of("ach_transfer_intention")

                /**
                 * ACH Transfer Rejection: details will be under the `ach_transfer_rejection`
                 * object.
                 */
                @JvmField val ACH_TRANSFER_REJECTION = of("ach_transfer_rejection")

                /** ACH Transfer Return: details will be under the `ach_transfer_return` object. */
                @JvmField val ACH_TRANSFER_RETURN = of("ach_transfer_return")

                /** Cashback Payment: details will be under the `cashback_payment` object. */
                @JvmField val CASHBACK_PAYMENT = of("cashback_payment")

                /**
                 * Legacy Card Dispute Acceptance: details will be under the
                 * `card_dispute_acceptance` object.
                 */
                @JvmField val CARD_DISPUTE_ACCEPTANCE = of("card_dispute_acceptance")

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

                /**
                 * Legacy Card Dispute Loss: details will be under the `card_dispute_loss` object.
                 */
                @JvmField val CARD_DISPUTE_LOSS = of("card_dispute_loss")

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

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

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

                /**
                 * Card Revenue Payment: details will be under the `card_revenue_payment` object.
                 */
                @JvmField val CARD_REVENUE_PAYMENT = of("card_revenue_payment")

                /**
                 * Check Deposit Acceptance: details will be under the `check_deposit_acceptance`
                 * object.
                 */
                @JvmField val CHECK_DEPOSIT_ACCEPTANCE = of("check_deposit_acceptance")

                /**
                 * Check Deposit Return: details will be under the `check_deposit_return` object.
                 */
                @JvmField val CHECK_DEPOSIT_RETURN = of("check_deposit_return")

                /**
                 * FedNow Transfer Acknowledgement: details will be under the
                 * `fednow_transfer_acknowledgement` object.
                 */
                @JvmField
                val FEDNOW_TRANSFER_ACKNOWLEDGEMENT = of("fednow_transfer_acknowledgement")

                /**
                 * Check Transfer Deposit: details will be under the `check_transfer_deposit`
                 * object.
                 */
                @JvmField val CHECK_TRANSFER_DEPOSIT = of("check_transfer_deposit")

                /** Fee Payment: details will be under the `fee_payment` object. */
                @JvmField val FEE_PAYMENT = of("fee_payment")

                /**
                 * Inbound ACH Transfer Intention: details will be under the `inbound_ach_transfer`
                 * object.
                 */
                @JvmField val INBOUND_ACH_TRANSFER = of("inbound_ach_transfer")

                /**
                 * Inbound ACH Transfer Return Intention: details will be under the
                 * `inbound_ach_transfer_return_intention` object.
                 */
                @JvmField
                val INBOUND_ACH_TRANSFER_RETURN_INTENTION =
                    of("inbound_ach_transfer_return_intention")

                /**
                 * Inbound Check Deposit Return Intention: details will be under the
                 * `inbound_check_deposit_return_intention` object.
                 */
                @JvmField
                val INBOUND_CHECK_DEPOSIT_RETURN_INTENTION =
                    of("inbound_check_deposit_return_intention")

                /**
                 * Inbound Check Adjustment: details will be under the `inbound_check_adjustment`
                 * object.
                 */
                @JvmField val INBOUND_CHECK_ADJUSTMENT = of("inbound_check_adjustment")

                /**
                 * Inbound FedNow Transfer Confirmation: details will be under the
                 * `inbound_fednow_transfer_confirmation` object.
                 */
                @JvmField
                val INBOUND_FEDNOW_TRANSFER_CONFIRMATION =
                    of("inbound_fednow_transfer_confirmation")

                /**
                 * Inbound Real-Time Payments Transfer Confirmation: details will be under the
                 * `inbound_real_time_payments_transfer_confirmation` object.
                 */
                @JvmField
                val INBOUND_REAL_TIME_PAYMENTS_TRANSFER_CONFIRMATION =
                    of("inbound_real_time_payments_transfer_confirmation")

                /**
                 * Inbound Wire Reversal: details will be under the `inbound_wire_reversal` object.
                 */
                @JvmField val INBOUND_WIRE_REVERSAL = of("inbound_wire_reversal")

                /**
                 * Inbound Wire Transfer Intention: details will be under the
                 * `inbound_wire_transfer` object.
                 */
                @JvmField val INBOUND_WIRE_TRANSFER = of("inbound_wire_transfer")

                /**
                 * Inbound Wire Transfer Reversal Intention: details will be under the
                 * `inbound_wire_transfer_reversal` object.
                 */
                @JvmField val INBOUND_WIRE_TRANSFER_REVERSAL = of("inbound_wire_transfer_reversal")

                /** Interest Payment: details will be under the `interest_payment` object. */
                @JvmField val INTEREST_PAYMENT = of("interest_payment")

                /** Internal Source: details will be under the `internal_source` object. */
                @JvmField val INTERNAL_SOURCE = of("internal_source")

                /**
                 * Real-Time Payments Transfer Acknowledgement: details will be under the
                 * `real_time_payments_transfer_acknowledgement` object.
                 */
                @JvmField
                val REAL_TIME_PAYMENTS_TRANSFER_ACKNOWLEDGEMENT =
                    of("real_time_payments_transfer_acknowledgement")

                /** Sample Funds: details will be under the `sample_funds` object. */
                @JvmField val SAMPLE_FUNDS = of("sample_funds")

                /**
                 * Wire Transfer Intention: details will be under the `wire_transfer_intention`
                 * object.
                 */
                @JvmField val WIRE_TRANSFER_INTENTION = of("wire_transfer_intention")

                /**
                 * Swift Transfer Intention: details will be under the `swift_transfer_intention`
                 * object.
                 */
                @JvmField val SWIFT_TRANSFER_INTENTION = of("swift_transfer_intention")

                /**
                 * Swift Transfer Return: details will be under the `swift_transfer_return` object.
                 */
                @JvmField val SWIFT_TRANSFER_RETURN = of("swift_transfer_return")

                /**
                 * Card Push Transfer Acceptance: details will be under the
                 * `card_push_transfer_acceptance` object.
                 */
                @JvmField val CARD_PUSH_TRANSFER_ACCEPTANCE = of("card_push_transfer_acceptance")

                /**
                 * Account Revenue Payment: details will be under the `account_revenue_payment`
                 * object.
                 */
                @JvmField val ACCOUNT_REVENUE_PAYMENT = of("account_revenue_payment")

                /**
                 * Blockchain On-Ramp Transfer Intention: details will be under the
                 * `blockchain_onramp_transfer_intention` object.
                 */
                @JvmField
                val BLOCKCHAIN_ONRAMP_TRANSFER_INTENTION =
                    of("blockchain_onramp_transfer_intention")

                /**
                 * Blockchain Off-Ramp Transfer Settlement: details will be under the
                 * `blockchain_offramp_transfer_settlement` object.
                 */
                @JvmField
                val BLOCKCHAIN_OFFRAMP_TRANSFER_SETTLEMENT =
                    of("blockchain_offramp_transfer_settlement")

                /** The Transaction was made for an undocumented or deprecated reason. */
                @JvmField val OTHER = of("other")

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

            /** An enum containing [Category]'s known values. */
            enum class Known {
                /**
                 * Account Transfer Intention: details will be under the
                 * `account_transfer_intention` object.
                 */
                ACCOUNT_TRANSFER_INTENTION,
                /**
                 * ACH Transfer Intention: details will be under the `ach_transfer_intention`
                 * object.
                 */
                ACH_TRANSFER_INTENTION,
                /**
                 * ACH Transfer Rejection: details will be under the `ach_transfer_rejection`
                 * object.
                 */
                ACH_TRANSFER_REJECTION,
                /** ACH Transfer Return: details will be under the `ach_transfer_return` object. */
                ACH_TRANSFER_RETURN,
                /** Cashback Payment: details will be under the `cashback_payment` object. */
                CASHBACK_PAYMENT,
                /**
                 * Legacy Card Dispute Acceptance: details will be under the
                 * `card_dispute_acceptance` object.
                 */
                CARD_DISPUTE_ACCEPTANCE,
                /**
                 * Card Dispute Financial: details will be under the `card_dispute_financial`
                 * object.
                 */
                CARD_DISPUTE_FINANCIAL,
                /**
                 * Legacy Card Dispute Loss: details will be under the `card_dispute_loss` object.
                 */
                CARD_DISPUTE_LOSS,
                /** Card Refund: details will be under the `card_refund` object. */
                CARD_REFUND,
                /** Card Settlement: details will be under the `card_settlement` object. */
                CARD_SETTLEMENT,
                /** Card Financial: details will be under the `card_financial` object. */
                CARD_FINANCIAL,
                /**
                 * Card Revenue Payment: details will be under the `card_revenue_payment` object.
                 */
                CARD_REVENUE_PAYMENT,
                /**
                 * Check Deposit Acceptance: details will be under the `check_deposit_acceptance`
                 * object.
                 */
                CHECK_DEPOSIT_ACCEPTANCE,
                /**
                 * Check Deposit Return: details will be under the `check_deposit_return` object.
                 */
                CHECK_DEPOSIT_RETURN,
                /**
                 * FedNow Transfer Acknowledgement: details will be under the
                 * `fednow_transfer_acknowledgement` object.
                 */
                FEDNOW_TRANSFER_ACKNOWLEDGEMENT,
                /**
                 * Check Transfer Deposit: details will be under the `check_transfer_deposit`
                 * object.
                 */
                CHECK_TRANSFER_DEPOSIT,
                /** Fee Payment: details will be under the `fee_payment` object. */
                FEE_PAYMENT,
                /**
                 * Inbound ACH Transfer Intention: details will be under the `inbound_ach_transfer`
                 * object.
                 */
                INBOUND_ACH_TRANSFER,
                /**
                 * Inbound ACH Transfer Return Intention: details will be under the
                 * `inbound_ach_transfer_return_intention` object.
                 */
                INBOUND_ACH_TRANSFER_RETURN_INTENTION,
                /**
                 * Inbound Check Deposit Return Intention: details will be under the
                 * `inbound_check_deposit_return_intention` object.
                 */
                INBOUND_CHECK_DEPOSIT_RETURN_INTENTION,
                /**
                 * Inbound Check Adjustment: details will be under the `inbound_check_adjustment`
                 * object.
                 */
                INBOUND_CHECK_ADJUSTMENT,
                /**
                 * Inbound FedNow Transfer Confirmation: details will be under the
                 * `inbound_fednow_transfer_confirmation` object.
                 */
                INBOUND_FEDNOW_TRANSFER_CONFIRMATION,
                /**
                 * Inbound Real-Time Payments Transfer Confirmation: details will be under the
                 * `inbound_real_time_payments_transfer_confirmation` object.
                 */
                INBOUND_REAL_TIME_PAYMENTS_TRANSFER_CONFIRMATION,
                /**
                 * Inbound Wire Reversal: details will be under the `inbound_wire_reversal` object.
                 */
                INBOUND_WIRE_REVERSAL,
                /**
                 * Inbound Wire Transfer Intention: details will be under the
                 * `inbound_wire_transfer` object.
                 */
                INBOUND_WIRE_TRANSFER,
                /**
                 * Inbound Wire Transfer Reversal Intention: details will be under the
                 * `inbound_wire_transfer_reversal` object.
                 */
                INBOUND_WIRE_TRANSFER_REVERSAL,
                /** Interest Payment: details will be under the `interest_payment` object. */
                INTEREST_PAYMENT,
                /** Internal Source: details will be under the `internal_source` object. */
                INTERNAL_SOURCE,
                /**
                 * Real-Time Payments Transfer Acknowledgement: details will be under the
                 * `real_time_payments_transfer_acknowledgement` object.
                 */
                REAL_TIME_PAYMENTS_TRANSFER_ACKNOWLEDGEMENT,
                /** Sample Funds: details will be under the `sample_funds` object. */
                SAMPLE_FUNDS,
                /**
                 * Wire Transfer Intention: details will be under the `wire_transfer_intention`
                 * object.
                 */
                WIRE_TRANSFER_INTENTION,
                /**
                 * Swift Transfer Intention: details will be under the `swift_transfer_intention`
                 * object.
                 */
                SWIFT_TRANSFER_INTENTION,
                /**
                 * Swift Transfer Return: details will be under the `swift_transfer_return` object.
                 */
                SWIFT_TRANSFER_RETURN,
                /**
                 * Card Push Transfer Acceptance: details will be under the
                 * `card_push_transfer_acceptance` object.
                 */
                CARD_PUSH_TRANSFER_ACCEPTANCE,
                /**
                 * Account Revenue Payment: details will be under the `account_revenue_payment`
                 * object.
                 */
                ACCOUNT_REVENUE_PAYMENT,
                /**
                 * Blockchain On-Ramp Transfer Intention: details will be under the
                 * `blockchain_onramp_transfer_intention` object.
                 */
                BLOCKCHAIN_ONRAMP_TRANSFER_INTENTION,
                /**
                 * Blockchain Off-Ramp Transfer Settlement: details will be under the
                 * `blockchain_offramp_transfer_settlement` object.
                 */
                BLOCKCHAIN_OFFRAMP_TRANSFER_SETTLEMENT,
                /** The Transaction was made for an undocumented or deprecated reason. */
                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 {
                /**
                 * Account Transfer Intention: details will be under the
                 * `account_transfer_intention` object.
                 */
                ACCOUNT_TRANSFER_INTENTION,
                /**
                 * ACH Transfer Intention: details will be under the `ach_transfer_intention`
                 * object.
                 */
                ACH_TRANSFER_INTENTION,
                /**
                 * ACH Transfer Rejection: details will be under the `ach_transfer_rejection`
                 * object.
                 */
                ACH_TRANSFER_REJECTION,
                /** ACH Transfer Return: details will be under the `ach_transfer_return` object. */
                ACH_TRANSFER_RETURN,
                /** Cashback Payment: details will be under the `cashback_payment` object. */
                CASHBACK_PAYMENT,
                /**
                 * Legacy Card Dispute Acceptance: details will be under the
                 * `card_dispute_acceptance` object.
                 */
                CARD_DISPUTE_ACCEPTANCE,
                /**
                 * Card Dispute Financial: details will be under the `card_dispute_financial`
                 * object.
                 */
                CARD_DISPUTE_FINANCIAL,
                /**
                 * Legacy Card Dispute Loss: details will be under the `card_dispute_loss` object.
                 */
                CARD_DISPUTE_LOSS,
                /** Card Refund: details will be under the `card_refund` object. */
                CARD_REFUND,
                /** Card Settlement: details will be under the `card_settlement` object. */
                CARD_SETTLEMENT,
                /** Card Financial: details will be under the `card_financial` object. */
                CARD_FINANCIAL,
                /**
                 * Card Revenue Payment: details will be under the `card_revenue_payment` object.
                 */
                CARD_REVENUE_PAYMENT,
                /**
                 * Check Deposit Acceptance: details will be under the `check_deposit_acceptance`
                 * object.
                 */
                CHECK_DEPOSIT_ACCEPTANCE,
                /**
                 * Check Deposit Return: details will be under the `check_deposit_return` object.
                 */
                CHECK_DEPOSIT_RETURN,
                /**
                 * FedNow Transfer Acknowledgement: details will be under the
                 * `fednow_transfer_acknowledgement` object.
                 */
                FEDNOW_TRANSFER_ACKNOWLEDGEMENT,
                /**
                 * Check Transfer Deposit: details will be under the `check_transfer_deposit`
                 * object.
                 */
                CHECK_TRANSFER_DEPOSIT,
                /** Fee Payment: details will be under the `fee_payment` object. */
                FEE_PAYMENT,
                /**
                 * Inbound ACH Transfer Intention: details will be under the `inbound_ach_transfer`
                 * object.
                 */
                INBOUND_ACH_TRANSFER,
                /**
                 * Inbound ACH Transfer Return Intention: details will be under the
                 * `inbound_ach_transfer_return_intention` object.
                 */
                INBOUND_ACH_TRANSFER_RETURN_INTENTION,
                /**
                 * Inbound Check Deposit Return Intention: details will be under the
                 * `inbound_check_deposit_return_intention` object.
                 */
                INBOUND_CHECK_DEPOSIT_RETURN_INTENTION,
                /**
                 * Inbound Check Adjustment: details will be under the `inbound_check_adjustment`
                 * object.
                 */
                INBOUND_CHECK_ADJUSTMENT,
                /**
                 * Inbound FedNow Transfer Confirmation: details will be under the
                 * `inbound_fednow_transfer_confirmation` object.
                 */
                INBOUND_FEDNOW_TRANSFER_CONFIRMATION,
                /**
                 * Inbound Real-Time Payments Transfer Confirmation: details will be under the
                 * `inbound_real_time_payments_transfer_confirmation` object.
                 */
                INBOUND_REAL_TIME_PAYMENTS_TRANSFER_CONFIRMATION,
                /**
                 * Inbound Wire Reversal: details will be under the `inbound_wire_reversal` object.
                 */
                INBOUND_WIRE_REVERSAL,
                /**
                 * Inbound Wire Transfer Intention: details will be under the
                 * `inbound_wire_transfer` object.
                 */
                INBOUND_WIRE_TRANSFER,
                /**
                 * Inbound Wire Transfer Reversal Intention: details will be under the
                 * `inbound_wire_transfer_reversal` object.
                 */
                INBOUND_WIRE_TRANSFER_REVERSAL,
                /** Interest Payment: details will be under the `interest_payment` object. */
                INTEREST_PAYMENT,
                /** Internal Source: details will be under the `internal_source` object. */
                INTERNAL_SOURCE,
                /**
                 * Real-Time Payments Transfer Acknowledgement: details will be under the
                 * `real_time_payments_transfer_acknowledgement` object.
                 */
                REAL_TIME_PAYMENTS_TRANSFER_ACKNOWLEDGEMENT,
                /** Sample Funds: details will be under the `sample_funds` object. */
                SAMPLE_FUNDS,
                /**
                 * Wire Transfer Intention: details will be under the `wire_transfer_intention`
                 * object.
                 */
                WIRE_TRANSFER_INTENTION,
                /**
                 * Swift Transfer Intention: details will be under the `swift_transfer_intention`
                 * object.
                 */
                SWIFT_TRANSFER_INTENTION,
                /**
                 * Swift Transfer Return: details will be under the `swift_transfer_return` object.
                 */
                SWIFT_TRANSFER_RETURN,
                /**
                 * Card Push Transfer Acceptance: details will be under the
                 * `card_push_transfer_acceptance` object.
                 */
                CARD_PUSH_TRANSFER_ACCEPTANCE,
                /**
                 * Account Revenue Payment: details will be under the `account_revenue_payment`
                 * object.
                 */
                ACCOUNT_REVENUE_PAYMENT,
                /**
                 * Blockchain On-Ramp Transfer Intention: details will be under the
                 * `blockchain_onramp_transfer_intention` object.
                 */
                BLOCKCHAIN_ONRAMP_TRANSFER_INTENTION,
                /**
                 * Blockchain Off-Ramp Transfer Settlement: details will be under the
                 * `blockchain_offramp_transfer_settlement` object.
                 */
                BLOCKCHAIN_OFFRAMP_TRANSFER_SETTLEMENT,
                /** The Transaction was made for an undocumented or deprecated reason. */
                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) {
                    ACCOUNT_TRANSFER_INTENTION -> Value.ACCOUNT_TRANSFER_INTENTION
                    ACH_TRANSFER_INTENTION -> Value.ACH_TRANSFER_INTENTION
                    ACH_TRANSFER_REJECTION -> Value.ACH_TRANSFER_REJECTION
                    ACH_TRANSFER_RETURN -> Value.ACH_TRANSFER_RETURN
                    CASHBACK_PAYMENT -> Value.CASHBACK_PAYMENT
                    CARD_DISPUTE_ACCEPTANCE -> Value.CARD_DISPUTE_ACCEPTANCE
                    CARD_DISPUTE_FINANCIAL -> Value.CARD_DISPUTE_FINANCIAL
                    CARD_DISPUTE_LOSS -> Value.CARD_DISPUTE_LOSS
                    CARD_REFUND -> Value.CARD_REFUND
                    CARD_SETTLEMENT -> Value.CARD_SETTLEMENT
                    CARD_FINANCIAL -> Value.CARD_FINANCIAL
                    CARD_REVENUE_PAYMENT -> Value.CARD_REVENUE_PAYMENT
                    CHECK_DEPOSIT_ACCEPTANCE -> Value.CHECK_DEPOSIT_ACCEPTANCE
                    CHECK_DEPOSIT_RETURN -> Value.CHECK_DEPOSIT_RETURN
                    FEDNOW_TRANSFER_ACKNOWLEDGEMENT -> Value.FEDNOW_TRANSFER_ACKNOWLEDGEMENT
                    CHECK_TRANSFER_DEPOSIT -> Value.CHECK_TRANSFER_DEPOSIT
                    FEE_PAYMENT -> Value.FEE_PAYMENT
                    INBOUND_ACH_TRANSFER -> Value.INBOUND_ACH_TRANSFER
                    INBOUND_ACH_TRANSFER_RETURN_INTENTION ->
                        Value.INBOUND_ACH_TRANSFER_RETURN_INTENTION
                    INBOUND_CHECK_DEPOSIT_RETURN_INTENTION ->
                        Value.INBOUND_CHECK_DEPOSIT_RETURN_INTENTION
                    INBOUND_CHECK_ADJUSTMENT -> Value.INBOUND_CHECK_ADJUSTMENT
                    INBOUND_FEDNOW_TRANSFER_CONFIRMATION ->
                        Value.INBOUND_FEDNOW_TRANSFER_CONFIRMATION
                    INBOUND_REAL_TIME_PAYMENTS_TRANSFER_CONFIRMATION ->
                        Value.INBOUND_REAL_TIME_PAYMENTS_TRANSFER_CONFIRMATION
                    INBOUND_WIRE_REVERSAL -> Value.INBOUND_WIRE_REVERSAL
                    INBOUND_WIRE_TRANSFER -> Value.INBOUND_WIRE_TRANSFER
                    INBOUND_WIRE_TRANSFER_REVERSAL -> Value.INBOUND_WIRE_TRANSFER_REVERSAL
                    INTEREST_PAYMENT -> Value.INTEREST_PAYMENT
                    INTERNAL_SOURCE -> Value.INTERNAL_SOURCE
                    REAL_TIME_PAYMENTS_TRANSFER_ACKNOWLEDGEMENT ->
                        Value.REAL_TIME_PAYMENTS_TRANSFER_ACKNOWLEDGEMENT
                    SAMPLE_FUNDS -> Value.SAMPLE_FUNDS
                    WIRE_TRANSFER_INTENTION -> Value.WIRE_TRANSFER_INTENTION
                    SWIFT_TRANSFER_INTENTION -> Value.SWIFT_TRANSFER_INTENTION
                    SWIFT_TRANSFER_RETURN -> Value.SWIFT_TRANSFER_RETURN
                    CARD_PUSH_TRANSFER_ACCEPTANCE -> Value.CARD_PUSH_TRANSFER_ACCEPTANCE
                    ACCOUNT_REVENUE_PAYMENT -> Value.ACCOUNT_REVENUE_PAYMENT
                    BLOCKCHAIN_ONRAMP_TRANSFER_INTENTION ->
                        Value.BLOCKCHAIN_ONRAMP_TRANSFER_INTENTION
                    BLOCKCHAIN_OFFRAMP_TRANSFER_SETTLEMENT ->
                        Value.BLOCKCHAIN_OFFRAMP_TRANSFER_SETTLEMENT
                    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) {
                    ACCOUNT_TRANSFER_INTENTION -> Known.ACCOUNT_TRANSFER_INTENTION
                    ACH_TRANSFER_INTENTION -> Known.ACH_TRANSFER_INTENTION
                    ACH_TRANSFER_REJECTION -> Known.ACH_TRANSFER_REJECTION
                    ACH_TRANSFER_RETURN -> Known.ACH_TRANSFER_RETURN
                    CASHBACK_PAYMENT -> Known.CASHBACK_PAYMENT
                    CARD_DISPUTE_ACCEPTANCE -> Known.CARD_DISPUTE_ACCEPTANCE
                    CARD_DISPUTE_FINANCIAL -> Known.CARD_DISPUTE_FINANCIAL
                    CARD_DISPUTE_LOSS -> Known.CARD_DISPUTE_LOSS
                    CARD_REFUND -> Known.CARD_REFUND
                    CARD_SETTLEMENT -> Known.CARD_SETTLEMENT
                    CARD_FINANCIAL -> Known.CARD_FINANCIAL
                    CARD_REVENUE_PAYMENT -> Known.CARD_REVENUE_PAYMENT
                    CHECK_DEPOSIT_ACCEPTANCE -> Known.CHECK_DEPOSIT_ACCEPTANCE
                    CHECK_DEPOSIT_RETURN -> Known.CHECK_DEPOSIT_RETURN
                    FEDNOW_TRANSFER_ACKNOWLEDGEMENT -> Known.FEDNOW_TRANSFER_ACKNOWLEDGEMENT
                    CHECK_TRANSFER_DEPOSIT -> Known.CHECK_TRANSFER_DEPOSIT
                    FEE_PAYMENT -> Known.FEE_PAYMENT
                    INBOUND_ACH_TRANSFER -> Known.INBOUND_ACH_TRANSFER
                    INBOUND_ACH_TRANSFER_RETURN_INTENTION ->
                        Known.INBOUND_ACH_TRANSFER_RETURN_INTENTION
                    INBOUND_CHECK_DEPOSIT_RETURN_INTENTION ->
                        Known.INBOUND_CHECK_DEPOSIT_RETURN_INTENTION
                    INBOUND_CHECK_ADJUSTMENT -> Known.INBOUND_CHECK_ADJUSTMENT
                    INBOUND_FEDNOW_TRANSFER_CONFIRMATION ->
                        Known.INBOUND_FEDNOW_TRANSFER_CONFIRMATION
                    INBOUND_REAL_TIME_PAYMENTS_TRANSFER_CONFIRMATION ->
                        Known.INBOUND_REAL_TIME_PAYMENTS_TRANSFER_CONFIRMATION
                    INBOUND_WIRE_REVERSAL -> Known.INBOUND_WIRE_REVERSAL
                    INBOUND_WIRE_TRANSFER -> Known.INBOUND_WIRE_TRANSFER
                    INBOUND_WIRE_TRANSFER_REVERSAL -> Known.INBOUND_WIRE_TRANSFER_REVERSAL
                    INTEREST_PAYMENT -> Known.INTEREST_PAYMENT
                    INTERNAL_SOURCE -> Known.INTERNAL_SOURCE
                    REAL_TIME_PAYMENTS_TRANSFER_ACKNOWLEDGEMENT ->
                        Known.REAL_TIME_PAYMENTS_TRANSFER_ACKNOWLEDGEMENT
                    SAMPLE_FUNDS -> Known.SAMPLE_FUNDS
                    WIRE_TRANSFER_INTENTION -> Known.WIRE_TRANSFER_INTENTION
                    SWIFT_TRANSFER_INTENTION -> Known.SWIFT_TRANSFER_INTENTION
                    SWIFT_TRANSFER_RETURN -> Known.SWIFT_TRANSFER_RETURN
                    CARD_PUSH_TRANSFER_ACCEPTANCE -> Known.CARD_PUSH_TRANSFER_ACCEPTANCE
                    ACCOUNT_REVENUE_PAYMENT -> Known.ACCOUNT_REVENUE_PAYMENT
                    BLOCKCHAIN_ONRAMP_TRANSFER_INTENTION ->
                        Known.BLOCKCHAIN_ONRAMP_TRANSFER_INTENTION
                    BLOCKCHAIN_OFFRAMP_TRANSFER_SETTLEMENT ->
                        Known.BLOCKCHAIN_OFFRAMP_TRANSFER_SETTLEMENT
                    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()
        }

        /**
         * An Account Revenue Payment object. This field will be present in the JSON response if and
         * only if `category` is equal to `account_revenue_payment`. An Account Revenue Payment
         * represents a payment made to an account from the bank. Account revenue is a type of
         * non-interest income.
         */
        class AccountRevenuePayment
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val accruedOnAccountId: JsonField<String>,
            private val periodEnd: JsonField<OffsetDateTime>,
            private val periodStart: JsonField<OffsetDateTime>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("accrued_on_account_id")
                @ExcludeMissing
                accruedOnAccountId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("period_end")
                @ExcludeMissing
                periodEnd: JsonField<OffsetDateTime> = JsonMissing.of(),
                @JsonProperty("period_start")
                @ExcludeMissing
                periodStart: JsonField<OffsetDateTime> = JsonMissing.of(),
            ) : this(accruedOnAccountId, periodEnd, periodStart, mutableMapOf())

            /**
             * The account on which the account revenue was accrued.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun accruedOnAccountId(): String =
                accruedOnAccountId.getRequired("accrued_on_account_id")

            /**
             * The end of the period for which this transaction paid account revenue.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun periodEnd(): OffsetDateTime = periodEnd.getRequired("period_end")

            /**
             * The start of the period for which this transaction paid account revenue.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun periodStart(): OffsetDateTime = periodStart.getRequired("period_start")

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

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

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

            @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
                 * [AccountRevenuePayment].
                 *
                 * The following fields are required:
                 * ```java
                 * .accruedOnAccountId()
                 * .periodEnd()
                 * .periodStart()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var accruedOnAccountId: JsonField<String>? = null
                private var periodEnd: JsonField<OffsetDateTime>? = null
                private var periodStart: JsonField<OffsetDateTime>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(accountRevenuePayment: AccountRevenuePayment) = apply {
                    accruedOnAccountId = accountRevenuePayment.accruedOnAccountId
                    periodEnd = accountRevenuePayment.periodEnd
                    periodStart = accountRevenuePayment.periodStart
                    additionalProperties = accountRevenuePayment.additionalProperties.toMutableMap()
                }

                /** The account on which the account revenue was accrued. */
                fun accruedOnAccountId(accruedOnAccountId: String) =
                    accruedOnAccountId(JsonField.of(accruedOnAccountId))

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

                /** The end of the period for which this transaction paid account revenue. */
                fun periodEnd(periodEnd: OffsetDateTime) = periodEnd(JsonField.of(periodEnd))

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

                /** The start of the period for which this transaction paid account revenue. */
                fun periodStart(periodStart: OffsetDateTime) =
                    periodStart(JsonField.of(periodStart))

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

                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 [AccountRevenuePayment].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .accruedOnAccountId()
                 * .periodEnd()
                 * .periodStart()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): AccountRevenuePayment =
                    AccountRevenuePayment(
                        checkRequired("accruedOnAccountId", accruedOnAccountId),
                        checkRequired("periodEnd", periodEnd),
                        checkRequired("periodStart", periodStart),
                        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(): AccountRevenuePayment = apply {
                if (validated) {
                    return@apply
                }

                accruedOnAccountId()
                periodEnd()
                periodStart()
                validated = true
            }

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

            /**
             * Returns 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 (accruedOnAccountId.asKnown().isPresent) 1 else 0) +
                    (if (periodEnd.asKnown().isPresent) 1 else 0) +
                    (if (periodStart.asKnown().isPresent) 1 else 0)

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

                return other is AccountRevenuePayment &&
                    accruedOnAccountId == other.accruedOnAccountId &&
                    periodEnd == other.periodEnd &&
                    periodStart == other.periodStart &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "AccountRevenuePayment{accruedOnAccountId=$accruedOnAccountId, periodEnd=$periodEnd, periodStart=$periodStart, additionalProperties=$additionalProperties}"
        }

        /**
         * An Account Transfer Intention object. This field will be present in the JSON response if
         * and only if `category` is equal to `account_transfer_intention`. Two Account Transfer
         * Intentions are created from each Account Transfer. One decrements the source account, and
         * the other increments the destination account.
         */
        class AccountTransferIntention
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val amount: JsonField<Long>,
            private val currency: JsonField<Currency>,
            private val description: JsonField<String>,
            private val destinationAccountId: JsonField<String>,
            private val sourceAccountId: JsonField<String>,
            private val transferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("description")
                @ExcludeMissing
                description: JsonField<String> = JsonMissing.of(),
                @JsonProperty("destination_account_id")
                @ExcludeMissing
                destinationAccountId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("source_account_id")
                @ExcludeMissing
                sourceAccountId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transfer_id")
                @ExcludeMissing
                transferId: JsonField<String> = JsonMissing.of(),
            ) : this(
                amount,
                currency,
                description,
                destinationAccountId,
                sourceAccountId,
                transferId,
                mutableMapOf(),
            )

            /**
             * 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 [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 description you chose to give the transfer.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun description(): String = description.getRequired("description")

            /**
             * The identifier of the Account to where the Account Transfer was sent.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun destinationAccountId(): String =
                destinationAccountId.getRequired("destination_account_id")

            /**
             * The identifier of the Account from where the Account Transfer was sent.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun sourceAccountId(): String = sourceAccountId.getRequired("source_account_id")

            /**
             * The identifier of the Account Transfer that led to this Pending 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 transferId(): String = transferId.getRequired("transfer_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 [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 [description].
             *
             * Unlike [description], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("description")
            @ExcludeMissing
            fun _description(): JsonField<String> = description

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

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

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

            @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
                 * [AccountTransferIntention].
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .currency()
                 * .description()
                 * .destinationAccountId()
                 * .sourceAccountId()
                 * .transferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var amount: JsonField<Long>? = null
                private var currency: JsonField<Currency>? = null
                private var description: JsonField<String>? = null
                private var destinationAccountId: JsonField<String>? = null
                private var sourceAccountId: JsonField<String>? = null
                private var transferId: JsonField<String>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(accountTransferIntention: AccountTransferIntention) = apply {
                    amount = accountTransferIntention.amount
                    currency = accountTransferIntention.currency
                    description = accountTransferIntention.description
                    destinationAccountId = accountTransferIntention.destinationAccountId
                    sourceAccountId = accountTransferIntention.sourceAccountId
                    transferId = accountTransferIntention.transferId
                    additionalProperties =
                        accountTransferIntention.additionalProperties.toMutableMap()
                }

                /**
                 * 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 [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 description you chose to give the transfer. */
                fun description(description: String) = description(JsonField.of(description))

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

                /** The identifier of the Account to where the Account Transfer was sent. */
                fun destinationAccountId(destinationAccountId: String) =
                    destinationAccountId(JsonField.of(destinationAccountId))

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

                /** The identifier of the Account from where the Account Transfer was sent. */
                fun sourceAccountId(sourceAccountId: String) =
                    sourceAccountId(JsonField.of(sourceAccountId))

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

                /** The identifier of the Account Transfer that led to this Pending Transaction. */
                fun transferId(transferId: String) = transferId(JsonField.of(transferId))

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

                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 [AccountTransferIntention].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .currency()
                 * .description()
                 * .destinationAccountId()
                 * .sourceAccountId()
                 * .transferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): AccountTransferIntention =
                    AccountTransferIntention(
                        checkRequired("amount", amount),
                        checkRequired("currency", currency),
                        checkRequired("description", description),
                        checkRequired("destinationAccountId", destinationAccountId),
                        checkRequired("sourceAccountId", sourceAccountId),
                        checkRequired("transferId", transferId),
                        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(): AccountTransferIntention = apply {
                if (validated) {
                    return@apply
                }

                amount()
                currency().validate()
                description()
                destinationAccountId()
                sourceAccountId()
                transferId()
                validated = true
            }

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

            /**
             * Returns 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) +
                    (if (description.asKnown().isPresent) 1 else 0) +
                    (if (destinationAccountId.asKnown().isPresent) 1 else 0) +
                    (if (sourceAccountId.asKnown().isPresent) 1 else 0) +
                    (if (transferId.asKnown().isPresent) 1 else 0)

            /**
             * 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()
            }

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

                return other is AccountTransferIntention &&
                    amount == other.amount &&
                    currency == other.currency &&
                    description == other.description &&
                    destinationAccountId == other.destinationAccountId &&
                    sourceAccountId == other.sourceAccountId &&
                    transferId == other.transferId &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    amount,
                    currency,
                    description,
                    destinationAccountId,
                    sourceAccountId,
                    transferId,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "AccountTransferIntention{amount=$amount, currency=$currency, description=$description, destinationAccountId=$destinationAccountId, sourceAccountId=$sourceAccountId, transferId=$transferId, additionalProperties=$additionalProperties}"
        }

        /**
         * An ACH Transfer Intention object. This field will be present in the JSON response if and
         * only if `category` is equal to `ach_transfer_intention`. An ACH Transfer Intention is
         * created from an ACH Transfer. It reflects the intention to move money into or out of an
         * Increase account via the ACH network.
         */
        class AchTransferIntention
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val accountNumber: JsonField<String>,
            private val amount: JsonField<Long>,
            private val routingNumber: JsonField<String>,
            private val statementDescriptor: JsonField<String>,
            private val transferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("account_number")
                @ExcludeMissing
                accountNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("routing_number")
                @ExcludeMissing
                routingNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("statement_descriptor")
                @ExcludeMissing
                statementDescriptor: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transfer_id")
                @ExcludeMissing
                transferId: JsonField<String> = JsonMissing.of(),
            ) : this(
                accountNumber,
                amount,
                routingNumber,
                statementDescriptor,
                transferId,
                mutableMapOf(),
            )

            /**
             * The account number for the destination account.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun accountNumber(): String = accountNumber.getRequired("account_number")

            /**
             * The 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 American Bankers' Association (ABA) Routing Transit Number (RTN) for the
             * destination account.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun routingNumber(): String = routingNumber.getRequired("routing_number")

            /**
             * A description set when the ACH Transfer 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 statementDescriptor(): String =
                statementDescriptor.getRequired("statement_descriptor")

            /**
             * The identifier of the ACH Transfer that led to 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 transferId(): String = transferId.getRequired("transfer_id")

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

            /**
             * 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 [routingNumber].
             *
             * Unlike [routingNumber], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("routing_number")
            @ExcludeMissing
            fun _routingNumber(): JsonField<String> = routingNumber

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

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

            @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 [AchTransferIntention].
                 *
                 * The following fields are required:
                 * ```java
                 * .accountNumber()
                 * .amount()
                 * .routingNumber()
                 * .statementDescriptor()
                 * .transferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var accountNumber: JsonField<String>? = null
                private var amount: JsonField<Long>? = null
                private var routingNumber: JsonField<String>? = null
                private var statementDescriptor: JsonField<String>? = null
                private var transferId: JsonField<String>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(achTransferIntention: AchTransferIntention) = apply {
                    accountNumber = achTransferIntention.accountNumber
                    amount = achTransferIntention.amount
                    routingNumber = achTransferIntention.routingNumber
                    statementDescriptor = achTransferIntention.statementDescriptor
                    transferId = achTransferIntention.transferId
                    additionalProperties = achTransferIntention.additionalProperties.toMutableMap()
                }

                /** The account number for the destination account. */
                fun accountNumber(accountNumber: String) =
                    accountNumber(JsonField.of(accountNumber))

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

                /**
                 * The 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 American Bankers' Association (ABA) Routing Transit Number (RTN) for the
                 * destination account.
                 */
                fun routingNumber(routingNumber: String) =
                    routingNumber(JsonField.of(routingNumber))

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

                /** A description set when the ACH Transfer was created. */
                fun statementDescriptor(statementDescriptor: String) =
                    statementDescriptor(JsonField.of(statementDescriptor))

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

                /** The identifier of the ACH Transfer that led to this Transaction. */
                fun transferId(transferId: String) = transferId(JsonField.of(transferId))

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

                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 [AchTransferIntention].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .accountNumber()
                 * .amount()
                 * .routingNumber()
                 * .statementDescriptor()
                 * .transferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): AchTransferIntention =
                    AchTransferIntention(
                        checkRequired("accountNumber", accountNumber),
                        checkRequired("amount", amount),
                        checkRequired("routingNumber", routingNumber),
                        checkRequired("statementDescriptor", statementDescriptor),
                        checkRequired("transferId", transferId),
                        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(): AchTransferIntention = apply {
                if (validated) {
                    return@apply
                }

                accountNumber()
                amount()
                routingNumber()
                statementDescriptor()
                transferId()
                validated = true
            }

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

            /**
             * Returns 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 (accountNumber.asKnown().isPresent) 1 else 0) +
                    (if (amount.asKnown().isPresent) 1 else 0) +
                    (if (routingNumber.asKnown().isPresent) 1 else 0) +
                    (if (statementDescriptor.asKnown().isPresent) 1 else 0) +
                    (if (transferId.asKnown().isPresent) 1 else 0)

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

                return other is AchTransferIntention &&
                    accountNumber == other.accountNumber &&
                    amount == other.amount &&
                    routingNumber == other.routingNumber &&
                    statementDescriptor == other.statementDescriptor &&
                    transferId == other.transferId &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    accountNumber,
                    amount,
                    routingNumber,
                    statementDescriptor,
                    transferId,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "AchTransferIntention{accountNumber=$accountNumber, amount=$amount, routingNumber=$routingNumber, statementDescriptor=$statementDescriptor, transferId=$transferId, additionalProperties=$additionalProperties}"
        }

        /**
         * An ACH Transfer Rejection object. This field will be present in the JSON response if and
         * only if `category` is equal to `ach_transfer_rejection`. An ACH Transfer Rejection is
         * created when an ACH Transfer is rejected by Increase. It offsets the ACH Transfer
         * Intention. These rejections are rare.
         */
        class AchTransferRejection
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val transferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

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

            /**
             * The identifier of the ACH Transfer that led to 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 transferId(): String = transferId.getRequired("transfer_id")

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

            @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 [AchTransferRejection].
                 *
                 * The following fields are required:
                 * ```java
                 * .transferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

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

                @JvmSynthetic
                internal fun from(achTransferRejection: AchTransferRejection) = apply {
                    transferId = achTransferRejection.transferId
                    additionalProperties = achTransferRejection.additionalProperties.toMutableMap()
                }

                /** The identifier of the ACH Transfer that led to this Transaction. */
                fun transferId(transferId: String) = transferId(JsonField.of(transferId))

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

                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 [AchTransferRejection].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .transferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): AchTransferRejection =
                    AchTransferRejection(
                        checkRequired("transferId", transferId),
                        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(): AchTransferRejection = apply {
                if (validated) {
                    return@apply
                }

                transferId()
                validated = true
            }

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

            /**
             * Returns 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 (transferId.asKnown().isPresent) 1 else 0)

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

                return other is AchTransferRejection &&
                    transferId == other.transferId &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "AchTransferRejection{transferId=$transferId, additionalProperties=$additionalProperties}"
        }

        /**
         * An ACH Transfer Return object. This field will be present in the JSON response if and
         * only if `category` is equal to `ach_transfer_return`. An ACH Transfer Return is created
         * when an ACH Transfer is returned by the receiving bank. It offsets the ACH Transfer
         * Intention. ACH Transfer Returns usually occur within the first two business days after
         * the transfer is initiated, but can occur much later. The return appears as a new posted
         * Transaction; no Pending Transaction is created.
         */
        class AchTransferReturn
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val addendaInformation: JsonField<String>,
            private val createdAt: JsonField<OffsetDateTime>,
            private val rawReturnReasonCode: JsonField<String>,
            private val returnReasonCode: JsonField<ReturnReasonCode>,
            private val traceNumber: JsonField<String>,
            private val transactionId: JsonField<String>,
            private val transferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("addenda_information")
                @ExcludeMissing
                addendaInformation: JsonField<String> = JsonMissing.of(),
                @JsonProperty("created_at")
                @ExcludeMissing
                createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                @JsonProperty("raw_return_reason_code")
                @ExcludeMissing
                rawReturnReasonCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("return_reason_code")
                @ExcludeMissing
                returnReasonCode: JsonField<ReturnReasonCode> = JsonMissing.of(),
                @JsonProperty("trace_number")
                @ExcludeMissing
                traceNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transaction_id")
                @ExcludeMissing
                transactionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transfer_id")
                @ExcludeMissing
                transferId: JsonField<String> = JsonMissing.of(),
            ) : this(
                addendaInformation,
                createdAt,
                rawReturnReasonCode,
                returnReasonCode,
                traceNumber,
                transactionId,
                transferId,
                mutableMapOf(),
            )

            /**
             * Additional free-form information included by the receiving bank in the return's
             * addenda record. This is raw, uninterpreted text whose presence and format are not
             * guaranteed. For a `file_record_edit_criteria` (R17) return the receiving bank may set
             * this to `QUESTIONABLE` (optionally followed by more text) to indicate it believes the
             * transfer was initiated under questionable circumstances.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun addendaInformation(): Optional<String> =
                addendaInformation.getOptional("addenda_information")

            /**
             * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the
             * transfer 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 three character ACH return code, in the range R01 to R85.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun rawReturnReasonCode(): String =
                rawReturnReasonCode.getRequired("raw_return_reason_code")

            /**
             * Why the ACH Transfer was returned. This reason code is sent by the receiving bank
             * back to Increase.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun returnReasonCode(): ReturnReasonCode =
                returnReasonCode.getRequired("return_reason_code")

            /**
             * A 15 digit number that was generated by the bank that initiated the return. The trace
             * number of the return is different than that of the original transfer. ACH trace
             * numbers are not unique, but along with the amount and date this number can be used to
             * identify the ACH return at the bank that initiated it.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun traceNumber(): String = traceNumber.getRequired("trace_number")

            /**
             * The identifier of the Transaction associated with this return.
             *
             * @throws IncreaseInvalidDataException if 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")

            /**
             * The identifier of the ACH Transfer associated with this return. This matches the
             * original Transaction's `source.ach_transfer_intention.transfer_id`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun transferId(): String = transferId.getRequired("transfer_id")

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

            /**
             * 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 [rawReturnReasonCode].
             *
             * Unlike [rawReturnReasonCode], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("raw_return_reason_code")
            @ExcludeMissing
            fun _rawReturnReasonCode(): JsonField<String> = rawReturnReasonCode

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

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

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

            @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 [AchTransferReturn].
                 *
                 * The following fields are required:
                 * ```java
                 * .addendaInformation()
                 * .createdAt()
                 * .rawReturnReasonCode()
                 * .returnReasonCode()
                 * .traceNumber()
                 * .transactionId()
                 * .transferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var addendaInformation: JsonField<String>? = null
                private var createdAt: JsonField<OffsetDateTime>? = null
                private var rawReturnReasonCode: JsonField<String>? = null
                private var returnReasonCode: JsonField<ReturnReasonCode>? = null
                private var traceNumber: JsonField<String>? = null
                private var transactionId: JsonField<String>? = null
                private var transferId: JsonField<String>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(achTransferReturn: AchTransferReturn) = apply {
                    addendaInformation = achTransferReturn.addendaInformation
                    createdAt = achTransferReturn.createdAt
                    rawReturnReasonCode = achTransferReturn.rawReturnReasonCode
                    returnReasonCode = achTransferReturn.returnReasonCode
                    traceNumber = achTransferReturn.traceNumber
                    transactionId = achTransferReturn.transactionId
                    transferId = achTransferReturn.transferId
                    additionalProperties = achTransferReturn.additionalProperties.toMutableMap()
                }

                /**
                 * Additional free-form information included by the receiving bank in the return's
                 * addenda record. This is raw, uninterpreted text whose presence and format are not
                 * guaranteed. For a `file_record_edit_criteria` (R17) return the receiving bank may
                 * set this to `QUESTIONABLE` (optionally followed by more text) to indicate it
                 * believes the transfer was initiated under questionable circumstances.
                 */
                fun addendaInformation(addendaInformation: String?) =
                    addendaInformation(JsonField.ofNullable(addendaInformation))

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

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

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the
                 * transfer 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 three character ACH return code, in the range R01 to R85. */
                fun rawReturnReasonCode(rawReturnReasonCode: String) =
                    rawReturnReasonCode(JsonField.of(rawReturnReasonCode))

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

                /**
                 * Why the ACH Transfer was returned. This reason code is sent by the receiving bank
                 * back to Increase.
                 */
                fun returnReasonCode(returnReasonCode: ReturnReasonCode) =
                    returnReasonCode(JsonField.of(returnReasonCode))

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

                /**
                 * A 15 digit number that was generated by the bank that initiated the return. The
                 * trace number of the return is different than that of the original transfer. ACH
                 * trace numbers are not unique, but along with the amount and date this number can
                 * be used to identify the ACH return at the bank that initiated it.
                 */
                fun traceNumber(traceNumber: String) = traceNumber(JsonField.of(traceNumber))

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

                /** The identifier of the Transaction associated with this return. */
                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
                }

                /**
                 * The identifier of the ACH Transfer associated with this return. This matches the
                 * original Transaction's `source.ach_transfer_intention.transfer_id`.
                 */
                fun transferId(transferId: String) = transferId(JsonField.of(transferId))

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

                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 [AchTransferReturn].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .addendaInformation()
                 * .createdAt()
                 * .rawReturnReasonCode()
                 * .returnReasonCode()
                 * .traceNumber()
                 * .transactionId()
                 * .transferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): AchTransferReturn =
                    AchTransferReturn(
                        checkRequired("addendaInformation", addendaInformation),
                        checkRequired("createdAt", createdAt),
                        checkRequired("rawReturnReasonCode", rawReturnReasonCode),
                        checkRequired("returnReasonCode", returnReasonCode),
                        checkRequired("traceNumber", traceNumber),
                        checkRequired("transactionId", transactionId),
                        checkRequired("transferId", transferId),
                        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(): AchTransferReturn = apply {
                if (validated) {
                    return@apply
                }

                addendaInformation()
                createdAt()
                rawReturnReasonCode()
                returnReasonCode().validate()
                traceNumber()
                transactionId()
                transferId()
                validated = true
            }

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

            /**
             * Returns 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 (addendaInformation.asKnown().isPresent) 1 else 0) +
                    (if (createdAt.asKnown().isPresent) 1 else 0) +
                    (if (rawReturnReasonCode.asKnown().isPresent) 1 else 0) +
                    (returnReasonCode.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (traceNumber.asKnown().isPresent) 1 else 0) +
                    (if (transactionId.asKnown().isPresent) 1 else 0) +
                    (if (transferId.asKnown().isPresent) 1 else 0)

            /**
             * Why the ACH Transfer was returned. This reason code is sent by the receiving bank
             * back to Increase.
             */
            class ReturnReasonCode
            @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 {

                    /**
                     * Code R01. Insufficient funds in the receiving account. Sometimes abbreviated
                     * to "NSF."
                     */
                    @JvmField val INSUFFICIENT_FUND = of("insufficient_fund")

                    /**
                     * Code R03. The account does not exist or the receiving bank was unable to
                     * locate it.
                     */
                    @JvmField val NO_ACCOUNT = of("no_account")

                    /** Code R02. The account is closed at the receiving bank. */
                    @JvmField val ACCOUNT_CLOSED = of("account_closed")

                    /** Code R04. The account number is invalid at the receiving bank. */
                    @JvmField
                    val INVALID_ACCOUNT_NUMBER_STRUCTURE = of("invalid_account_number_structure")

                    /**
                     * Code R16. This return code has two separate meanings. (1) The receiving bank
                     * froze the account or (2) the Office of Foreign Assets Control (OFAC)
                     * instructed the receiving bank to return the entry.
                     */
                    @JvmField
                    val ACCOUNT_FROZEN_ENTRY_RETURNED_PER_OFAC_INSTRUCTION =
                        of("account_frozen_entry_returned_per_ofac_instruction")

                    /** Code R23. The receiving bank refused the credit transfer. */
                    @JvmField
                    val CREDIT_ENTRY_REFUSED_BY_RECEIVER = of("credit_entry_refused_by_receiver")

                    /**
                     * Code R05. The receiving bank rejected because of an incorrect Standard Entry
                     * Class code. Consumer accounts cannot be debited as
                     * `corporate_credit_or_debit` or `corporate_trade_exchange`.
                     */
                    @JvmField
                    val UNAUTHORIZED_DEBIT_TO_CONSUMER_ACCOUNT_USING_CORPORATE_SEC_CODE =
                        of("unauthorized_debit_to_consumer_account_using_corporate_sec_code")

                    /**
                     * Code R29. The corporate customer at the receiving bank reversed the transfer.
                     */
                    @JvmField
                    val CORPORATE_CUSTOMER_ADVISED_NOT_AUTHORIZED =
                        of("corporate_customer_advised_not_authorized")

                    /** Code R08. The receiving bank stopped payment on this transfer. */
                    @JvmField val PAYMENT_STOPPED = of("payment_stopped")

                    /**
                     * Code R20. The account is not eligible for ACH, such as a savings account with
                     * transaction limits.
                     */
                    @JvmField val NON_TRANSACTION_ACCOUNT = of("non_transaction_account")

                    /**
                     * Code R09. The receiving bank account does not have enough available balance
                     * for the transfer.
                     */
                    @JvmField val UNCOLLECTED_FUNDS = of("uncollected_funds")

                    /** Code R28. The routing number is incorrect. */
                    @JvmField
                    val ROUTING_NUMBER_CHECK_DIGIT_ERROR = of("routing_number_check_digit_error")

                    /** Code R10. The customer at the receiving bank reversed the transfer. */
                    @JvmField
                    val CUSTOMER_ADVISED_UNAUTHORIZED_IMPROPER_INELIGIBLE_OR_INCOMPLETE =
                        of("customer_advised_unauthorized_improper_ineligible_or_incomplete")

                    /** Code R19. The amount field is incorrect or too large. */
                    @JvmField val AMOUNT_FIELD_ERROR = of("amount_field_error")

                    /**
                     * Code R07. The customer revoked their authorization for a previously
                     * authorized transfer.
                     */
                    @JvmField
                    val AUTHORIZATION_REVOKED_BY_CUSTOMER = of("authorization_revoked_by_customer")

                    /** Code R13. The routing number is invalid. */
                    @JvmField val INVALID_ACH_ROUTING_NUMBER = of("invalid_ach_routing_number")

                    /**
                     * Code R17. This return code has multiple meanings. The receiving bank was
                     * either unable to process a field in the transfer, or believes the transfer
                     * was initiated under questionable circumstances (such as fraud), or identified
                     * an improperly-initiated reversing entry.
                     */
                    @JvmField val FILE_RECORD_EDIT_CRITERIA = of("file_record_edit_criteria")

                    /** Code R45. A rare return reason. The individual name field was invalid. */
                    @JvmField val ENR_INVALID_INDIVIDUAL_NAME = of("enr_invalid_individual_name")

                    /**
                     * Code R06. The originating financial institution asked for this transfer to be
                     * returned. The receiving bank is complying with the request.
                     */
                    @JvmField val RETURNED_PER_ODFI_REQUEST = of("returned_per_odfi_request")

                    /**
                     * Code R34. The receiving bank's regulatory supervisor has limited their
                     * participation in the ACH network.
                     */
                    @JvmField val LIMITED_PARTICIPATION_DFI = of("limited_participation_dfi")

                    /** Code R85. The outbound international ACH transfer was incorrect. */
                    @JvmField
                    val INCORRECTLY_CODED_OUTBOUND_INTERNATIONAL_PAYMENT =
                        of("incorrectly_coded_outbound_international_payment")

                    /** Code R12. A rare return reason. The account was sold to another bank. */
                    @JvmField val ACCOUNT_SOLD_TO_ANOTHER_DFI = of("account_sold_to_another_dfi")

                    /** Code R25. The addenda record is incorrect or missing. */
                    @JvmField val ADDENDA_ERROR = of("addenda_error")

                    /** Code R15. A rare return reason. The account holder is deceased. */
                    @JvmField
                    val BENEFICIARY_OR_ACCOUNT_HOLDER_DECEASED =
                        of("beneficiary_or_account_holder_deceased")

                    /**
                     * Code R11. A rare return reason. The customer authorized some payment to the
                     * sender, but this payment was not in error.
                     */
                    @JvmField
                    val CUSTOMER_ADVISED_NOT_WITHIN_AUTHORIZATION_TERMS =
                        of("customer_advised_not_within_authorization_terms")

                    /**
                     * Code R74. A rare return reason. Sent in response to a return that was
                     * returned with code `field_error`. The latest return should include the
                     * corrected field(s).
                     */
                    @JvmField val CORRECTED_RETURN = of("corrected_return")

                    /**
                     * Code R24. A rare return reason. The receiving bank received an exact
                     * duplicate entry with the same trace number and amount.
                     */
                    @JvmField val DUPLICATE_ENTRY = of("duplicate_entry")

                    /**
                     * Code R67. A rare return reason. The return this message refers to was a
                     * duplicate.
                     */
                    @JvmField val DUPLICATE_RETURN = of("duplicate_return")

                    /**
                     * Code R47. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    @JvmField val ENR_DUPLICATE_ENROLLMENT = of("enr_duplicate_enrollment")

                    /**
                     * Code R43. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    @JvmField
                    val ENR_INVALID_DFI_ACCOUNT_NUMBER = of("enr_invalid_dfi_account_number")

                    /**
                     * Code R44. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    @JvmField
                    val ENR_INVALID_INDIVIDUAL_ID_NUMBER = of("enr_invalid_individual_id_number")

                    /**
                     * Code R46. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    @JvmField
                    val ENR_INVALID_REPRESENTATIVE_PAYEE_INDICATOR =
                        of("enr_invalid_representative_payee_indicator")

                    /**
                     * Code R41. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    @JvmField val ENR_INVALID_TRANSACTION_CODE = of("enr_invalid_transaction_code")

                    /**
                     * Code R40. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    @JvmField val ENR_RETURN_OF_ENR_ENTRY = of("enr_return_of_enr_entry")

                    /**
                     * Code R42. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    @JvmField
                    val ENR_ROUTING_NUMBER_CHECK_DIGIT_ERROR =
                        of("enr_routing_number_check_digit_error")

                    /**
                     * Code R84. A rare return reason. The International ACH Transfer cannot be
                     * processed by the gateway.
                     */
                    @JvmField
                    val ENTRY_NOT_PROCESSED_BY_GATEWAY = of("entry_not_processed_by_gateway")

                    /**
                     * Code R69. A rare return reason. One or more of the fields in the ACH were
                     * malformed.
                     */
                    @JvmField val FIELD_ERROR = of("field_error")

                    /**
                     * Code R83. A rare return reason. The Foreign receiving bank was unable to
                     * settle this ACH transfer.
                     */
                    @JvmField
                    val FOREIGN_RECEIVING_DFI_UNABLE_TO_SETTLE =
                        of("foreign_receiving_dfi_unable_to_settle")

                    /**
                     * Code R80. A rare return reason. The International ACH Transfer is malformed.
                     */
                    @JvmField val IAT_ENTRY_CODING_ERROR = of("iat_entry_coding_error")

                    /**
                     * Code R18. A rare return reason. The ACH has an improper effective entry date
                     * field.
                     */
                    @JvmField
                    val IMPROPER_EFFECTIVE_ENTRY_DATE = of("improper_effective_entry_date")

                    /**
                     * Code R39. A rare return reason. The source document related to this ACH,
                     * usually an ACH check conversion, was presented to the bank.
                     */
                    @JvmField
                    val IMPROPER_SOURCE_DOCUMENT_SOURCE_DOCUMENT_PRESENTED =
                        of("improper_source_document_source_document_presented")

                    /**
                     * Code R21. A rare return reason. The Company ID field of the ACH was invalid.
                     */
                    @JvmField val INVALID_COMPANY_ID = of("invalid_company_id")

                    /**
                     * Code R82. A rare return reason. The foreign receiving bank identifier for an
                     * International ACH Transfer was invalid.
                     */
                    @JvmField
                    val INVALID_FOREIGN_RECEIVING_DFI_IDENTIFICATION =
                        of("invalid_foreign_receiving_dfi_identification")

                    /**
                     * Code R22. A rare return reason. The Individual ID number field of the ACH was
                     * invalid.
                     */
                    @JvmField val INVALID_INDIVIDUAL_ID_NUMBER = of("invalid_individual_id_number")

                    /**
                     * Code R53. A rare return reason. Both the Represented Check ("RCK") entry and
                     * the original check were presented to the bank.
                     */
                    @JvmField
                    val ITEM_AND_RCK_ENTRY_PRESENTED_FOR_PAYMENT =
                        of("item_and_rck_entry_presented_for_payment")

                    /**
                     * Code R51. A rare return reason. The Represented Check ("RCK") entry is
                     * ineligible.
                     */
                    @JvmField
                    val ITEM_RELATED_TO_RCK_ENTRY_IS_INELIGIBLE =
                        of("item_related_to_rck_entry_is_ineligible")

                    /** Code R26. A rare return reason. The ACH is missing a required field. */
                    @JvmField val MANDATORY_FIELD_ERROR = of("mandatory_field_error")

                    /**
                     * Code R71. A rare return reason. The receiving bank does not recognize the
                     * routing number in a dishonored return entry.
                     */
                    @JvmField val MISROUTED_DISHONORED_RETURN = of("misrouted_dishonored_return")

                    /**
                     * Code R61. A rare return reason. The receiving bank does not recognize the
                     * routing number in a return entry.
                     */
                    @JvmField val MISROUTED_RETURN = of("misrouted_return")

                    /**
                     * Code R76. A rare return reason. Sent in response to a return, the bank does
                     * not find the errors alleged by the returning bank.
                     */
                    @JvmField val NO_ERRORS_FOUND = of("no_errors_found")

                    /**
                     * Code R77. A rare return reason. The receiving bank does not accept the return
                     * of the erroneous debit. The funds are not available at the receiving bank.
                     */
                    @JvmField
                    val NON_ACCEPTANCE_OF_R62_DISHONORED_RETURN =
                        of("non_acceptance_of_r62_dishonored_return")

                    /**
                     * Code R81. A rare return reason. The receiving bank does not accept
                     * International ACH Transfers.
                     */
                    @JvmField
                    val NON_PARTICIPANT_IN_IAT_PROGRAM = of("non_participant_in_iat_program")

                    /**
                     * Code R31. A rare return reason. A return that has been agreed to be accepted
                     * by the receiving bank, despite falling outside of the usual return timeframe.
                     */
                    @JvmField val PERMISSIBLE_RETURN_ENTRY = of("permissible_return_entry")

                    /**
                     * Code R70. A rare return reason. The receiving bank had not approved this
                     * return.
                     */
                    @JvmField
                    val PERMISSIBLE_RETURN_ENTRY_NOT_ACCEPTED =
                        of("permissible_return_entry_not_accepted")

                    /**
                     * Code R32. A rare return reason. The receiving bank could not settle this
                     * transaction.
                     */
                    @JvmField val RDFI_NON_SETTLEMENT = of("rdfi_non_settlement")

                    /**
                     * Code R30. A rare return reason. The receiving bank does not accept Check
                     * Truncation ACH transfers.
                     */
                    @JvmField
                    val RDFI_PARTICIPANT_IN_CHECK_TRUNCATION_PROGRAM =
                        of("rdfi_participant_in_check_truncation_program")

                    /** Code R14. A rare return reason. The payee is deceased. */
                    @JvmField
                    val REPRESENTATIVE_PAYEE_DECEASED_OR_UNABLE_TO_CONTINUE_IN_THAT_CAPACITY =
                        of("representative_payee_deceased_or_unable_to_continue_in_that_capacity")

                    /**
                     * Code R75. A rare return reason. The originating bank disputes that an earlier
                     * `duplicate_entry` return was actually a duplicate.
                     */
                    @JvmField val RETURN_NOT_A_DUPLICATE = of("return_not_a_duplicate")

                    /**
                     * Code R62. A rare return reason. The originating financial institution made a
                     * mistake and this return corrects it.
                     */
                    @JvmField
                    val RETURN_OF_ERRONEOUS_OR_REVERSING_DEBIT =
                        of("return_of_erroneous_or_reversing_debit")

                    /** Code R36. A rare return reason. Return of a malformed credit entry. */
                    @JvmField
                    val RETURN_OF_IMPROPER_CREDIT_ENTRY = of("return_of_improper_credit_entry")

                    /** Code R35. A rare return reason. Return of a malformed debit entry. */
                    @JvmField
                    val RETURN_OF_IMPROPER_DEBIT_ENTRY = of("return_of_improper_debit_entry")

                    /**
                     * Code R33. A rare return reason. Return of a destroyed check ("XCK") entry.
                     */
                    @JvmField val RETURN_OF_XCK_ENTRY = of("return_of_xck_entry")

                    /**
                     * Code R37. A rare return reason. The source document related to this ACH,
                     * usually an ACH check conversion, was presented to the bank.
                     */
                    @JvmField
                    val SOURCE_DOCUMENT_PRESENTED_FOR_PAYMENT =
                        of("source_document_presented_for_payment")

                    /**
                     * Code R50. A rare return reason. State law prevents the bank from accepting
                     * the Represented Check ("RCK") entry.
                     */
                    @JvmField
                    val STATE_LAW_AFFECTING_RCK_ACCEPTANCE =
                        of("state_law_affecting_rck_acceptance")

                    /**
                     * Code R52. A rare return reason. A stop payment was issued on a Represented
                     * Check ("RCK") entry.
                     */
                    @JvmField
                    val STOP_PAYMENT_ON_ITEM_RELATED_TO_RCK_ENTRY =
                        of("stop_payment_on_item_related_to_rck_entry")

                    /**
                     * Code R38. A rare return reason. The source attached to the ACH, usually an
                     * ACH check conversion, includes a stop payment.
                     */
                    @JvmField
                    val STOP_PAYMENT_ON_SOURCE_DOCUMENT = of("stop_payment_on_source_document")

                    /**
                     * Code R73. A rare return reason. The bank receiving an `untimely_return`
                     * believes it was on time.
                     */
                    @JvmField val TIMELY_ORIGINAL_RETURN = of("timely_original_return")

                    /**
                     * Code R27. A rare return reason. An ACH return's trace number does not match
                     * an originated ACH.
                     */
                    @JvmField val TRACE_NUMBER_ERROR = of("trace_number_error")

                    /** Code R72. A rare return reason. The dishonored return was sent too late. */
                    @JvmField val UNTIMELY_DISHONORED_RETURN = of("untimely_dishonored_return")

                    /** Code R68. A rare return reason. The return was sent too late. */
                    @JvmField val UNTIMELY_RETURN = of("untimely_return")

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

                /** An enum containing [ReturnReasonCode]'s known values. */
                enum class Known {
                    /**
                     * Code R01. Insufficient funds in the receiving account. Sometimes abbreviated
                     * to "NSF."
                     */
                    INSUFFICIENT_FUND,
                    /**
                     * Code R03. The account does not exist or the receiving bank was unable to
                     * locate it.
                     */
                    NO_ACCOUNT,
                    /** Code R02. The account is closed at the receiving bank. */
                    ACCOUNT_CLOSED,
                    /** Code R04. The account number is invalid at the receiving bank. */
                    INVALID_ACCOUNT_NUMBER_STRUCTURE,
                    /**
                     * Code R16. This return code has two separate meanings. (1) The receiving bank
                     * froze the account or (2) the Office of Foreign Assets Control (OFAC)
                     * instructed the receiving bank to return the entry.
                     */
                    ACCOUNT_FROZEN_ENTRY_RETURNED_PER_OFAC_INSTRUCTION,
                    /** Code R23. The receiving bank refused the credit transfer. */
                    CREDIT_ENTRY_REFUSED_BY_RECEIVER,
                    /**
                     * Code R05. The receiving bank rejected because of an incorrect Standard Entry
                     * Class code. Consumer accounts cannot be debited as
                     * `corporate_credit_or_debit` or `corporate_trade_exchange`.
                     */
                    UNAUTHORIZED_DEBIT_TO_CONSUMER_ACCOUNT_USING_CORPORATE_SEC_CODE,
                    /**
                     * Code R29. The corporate customer at the receiving bank reversed the transfer.
                     */
                    CORPORATE_CUSTOMER_ADVISED_NOT_AUTHORIZED,
                    /** Code R08. The receiving bank stopped payment on this transfer. */
                    PAYMENT_STOPPED,
                    /**
                     * Code R20. The account is not eligible for ACH, such as a savings account with
                     * transaction limits.
                     */
                    NON_TRANSACTION_ACCOUNT,
                    /**
                     * Code R09. The receiving bank account does not have enough available balance
                     * for the transfer.
                     */
                    UNCOLLECTED_FUNDS,
                    /** Code R28. The routing number is incorrect. */
                    ROUTING_NUMBER_CHECK_DIGIT_ERROR,
                    /** Code R10. The customer at the receiving bank reversed the transfer. */
                    CUSTOMER_ADVISED_UNAUTHORIZED_IMPROPER_INELIGIBLE_OR_INCOMPLETE,
                    /** Code R19. The amount field is incorrect or too large. */
                    AMOUNT_FIELD_ERROR,
                    /**
                     * Code R07. The customer revoked their authorization for a previously
                     * authorized transfer.
                     */
                    AUTHORIZATION_REVOKED_BY_CUSTOMER,
                    /** Code R13. The routing number is invalid. */
                    INVALID_ACH_ROUTING_NUMBER,
                    /**
                     * Code R17. This return code has multiple meanings. The receiving bank was
                     * either unable to process a field in the transfer, or believes the transfer
                     * was initiated under questionable circumstances (such as fraud), or identified
                     * an improperly-initiated reversing entry.
                     */
                    FILE_RECORD_EDIT_CRITERIA,
                    /** Code R45. A rare return reason. The individual name field was invalid. */
                    ENR_INVALID_INDIVIDUAL_NAME,
                    /**
                     * Code R06. The originating financial institution asked for this transfer to be
                     * returned. The receiving bank is complying with the request.
                     */
                    RETURNED_PER_ODFI_REQUEST,
                    /**
                     * Code R34. The receiving bank's regulatory supervisor has limited their
                     * participation in the ACH network.
                     */
                    LIMITED_PARTICIPATION_DFI,
                    /** Code R85. The outbound international ACH transfer was incorrect. */
                    INCORRECTLY_CODED_OUTBOUND_INTERNATIONAL_PAYMENT,
                    /** Code R12. A rare return reason. The account was sold to another bank. */
                    ACCOUNT_SOLD_TO_ANOTHER_DFI,
                    /** Code R25. The addenda record is incorrect or missing. */
                    ADDENDA_ERROR,
                    /** Code R15. A rare return reason. The account holder is deceased. */
                    BENEFICIARY_OR_ACCOUNT_HOLDER_DECEASED,
                    /**
                     * Code R11. A rare return reason. The customer authorized some payment to the
                     * sender, but this payment was not in error.
                     */
                    CUSTOMER_ADVISED_NOT_WITHIN_AUTHORIZATION_TERMS,
                    /**
                     * Code R74. A rare return reason. Sent in response to a return that was
                     * returned with code `field_error`. The latest return should include the
                     * corrected field(s).
                     */
                    CORRECTED_RETURN,
                    /**
                     * Code R24. A rare return reason. The receiving bank received an exact
                     * duplicate entry with the same trace number and amount.
                     */
                    DUPLICATE_ENTRY,
                    /**
                     * Code R67. A rare return reason. The return this message refers to was a
                     * duplicate.
                     */
                    DUPLICATE_RETURN,
                    /**
                     * Code R47. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    ENR_DUPLICATE_ENROLLMENT,
                    /**
                     * Code R43. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    ENR_INVALID_DFI_ACCOUNT_NUMBER,
                    /**
                     * Code R44. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    ENR_INVALID_INDIVIDUAL_ID_NUMBER,
                    /**
                     * Code R46. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    ENR_INVALID_REPRESENTATIVE_PAYEE_INDICATOR,
                    /**
                     * Code R41. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    ENR_INVALID_TRANSACTION_CODE,
                    /**
                     * Code R40. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    ENR_RETURN_OF_ENR_ENTRY,
                    /**
                     * Code R42. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    ENR_ROUTING_NUMBER_CHECK_DIGIT_ERROR,
                    /**
                     * Code R84. A rare return reason. The International ACH Transfer cannot be
                     * processed by the gateway.
                     */
                    ENTRY_NOT_PROCESSED_BY_GATEWAY,
                    /**
                     * Code R69. A rare return reason. One or more of the fields in the ACH were
                     * malformed.
                     */
                    FIELD_ERROR,
                    /**
                     * Code R83. A rare return reason. The Foreign receiving bank was unable to
                     * settle this ACH transfer.
                     */
                    FOREIGN_RECEIVING_DFI_UNABLE_TO_SETTLE,
                    /**
                     * Code R80. A rare return reason. The International ACH Transfer is malformed.
                     */
                    IAT_ENTRY_CODING_ERROR,
                    /**
                     * Code R18. A rare return reason. The ACH has an improper effective entry date
                     * field.
                     */
                    IMPROPER_EFFECTIVE_ENTRY_DATE,
                    /**
                     * Code R39. A rare return reason. The source document related to this ACH,
                     * usually an ACH check conversion, was presented to the bank.
                     */
                    IMPROPER_SOURCE_DOCUMENT_SOURCE_DOCUMENT_PRESENTED,
                    /**
                     * Code R21. A rare return reason. The Company ID field of the ACH was invalid.
                     */
                    INVALID_COMPANY_ID,
                    /**
                     * Code R82. A rare return reason. The foreign receiving bank identifier for an
                     * International ACH Transfer was invalid.
                     */
                    INVALID_FOREIGN_RECEIVING_DFI_IDENTIFICATION,
                    /**
                     * Code R22. A rare return reason. The Individual ID number field of the ACH was
                     * invalid.
                     */
                    INVALID_INDIVIDUAL_ID_NUMBER,
                    /**
                     * Code R53. A rare return reason. Both the Represented Check ("RCK") entry and
                     * the original check were presented to the bank.
                     */
                    ITEM_AND_RCK_ENTRY_PRESENTED_FOR_PAYMENT,
                    /**
                     * Code R51. A rare return reason. The Represented Check ("RCK") entry is
                     * ineligible.
                     */
                    ITEM_RELATED_TO_RCK_ENTRY_IS_INELIGIBLE,
                    /** Code R26. A rare return reason. The ACH is missing a required field. */
                    MANDATORY_FIELD_ERROR,
                    /**
                     * Code R71. A rare return reason. The receiving bank does not recognize the
                     * routing number in a dishonored return entry.
                     */
                    MISROUTED_DISHONORED_RETURN,
                    /**
                     * Code R61. A rare return reason. The receiving bank does not recognize the
                     * routing number in a return entry.
                     */
                    MISROUTED_RETURN,
                    /**
                     * Code R76. A rare return reason. Sent in response to a return, the bank does
                     * not find the errors alleged by the returning bank.
                     */
                    NO_ERRORS_FOUND,
                    /**
                     * Code R77. A rare return reason. The receiving bank does not accept the return
                     * of the erroneous debit. The funds are not available at the receiving bank.
                     */
                    NON_ACCEPTANCE_OF_R62_DISHONORED_RETURN,
                    /**
                     * Code R81. A rare return reason. The receiving bank does not accept
                     * International ACH Transfers.
                     */
                    NON_PARTICIPANT_IN_IAT_PROGRAM,
                    /**
                     * Code R31. A rare return reason. A return that has been agreed to be accepted
                     * by the receiving bank, despite falling outside of the usual return timeframe.
                     */
                    PERMISSIBLE_RETURN_ENTRY,
                    /**
                     * Code R70. A rare return reason. The receiving bank had not approved this
                     * return.
                     */
                    PERMISSIBLE_RETURN_ENTRY_NOT_ACCEPTED,
                    /**
                     * Code R32. A rare return reason. The receiving bank could not settle this
                     * transaction.
                     */
                    RDFI_NON_SETTLEMENT,
                    /**
                     * Code R30. A rare return reason. The receiving bank does not accept Check
                     * Truncation ACH transfers.
                     */
                    RDFI_PARTICIPANT_IN_CHECK_TRUNCATION_PROGRAM,
                    /** Code R14. A rare return reason. The payee is deceased. */
                    REPRESENTATIVE_PAYEE_DECEASED_OR_UNABLE_TO_CONTINUE_IN_THAT_CAPACITY,
                    /**
                     * Code R75. A rare return reason. The originating bank disputes that an earlier
                     * `duplicate_entry` return was actually a duplicate.
                     */
                    RETURN_NOT_A_DUPLICATE,
                    /**
                     * Code R62. A rare return reason. The originating financial institution made a
                     * mistake and this return corrects it.
                     */
                    RETURN_OF_ERRONEOUS_OR_REVERSING_DEBIT,
                    /** Code R36. A rare return reason. Return of a malformed credit entry. */
                    RETURN_OF_IMPROPER_CREDIT_ENTRY,
                    /** Code R35. A rare return reason. Return of a malformed debit entry. */
                    RETURN_OF_IMPROPER_DEBIT_ENTRY,
                    /**
                     * Code R33. A rare return reason. Return of a destroyed check ("XCK") entry.
                     */
                    RETURN_OF_XCK_ENTRY,
                    /**
                     * Code R37. A rare return reason. The source document related to this ACH,
                     * usually an ACH check conversion, was presented to the bank.
                     */
                    SOURCE_DOCUMENT_PRESENTED_FOR_PAYMENT,
                    /**
                     * Code R50. A rare return reason. State law prevents the bank from accepting
                     * the Represented Check ("RCK") entry.
                     */
                    STATE_LAW_AFFECTING_RCK_ACCEPTANCE,
                    /**
                     * Code R52. A rare return reason. A stop payment was issued on a Represented
                     * Check ("RCK") entry.
                     */
                    STOP_PAYMENT_ON_ITEM_RELATED_TO_RCK_ENTRY,
                    /**
                     * Code R38. A rare return reason. The source attached to the ACH, usually an
                     * ACH check conversion, includes a stop payment.
                     */
                    STOP_PAYMENT_ON_SOURCE_DOCUMENT,
                    /**
                     * Code R73. A rare return reason. The bank receiving an `untimely_return`
                     * believes it was on time.
                     */
                    TIMELY_ORIGINAL_RETURN,
                    /**
                     * Code R27. A rare return reason. An ACH return's trace number does not match
                     * an originated ACH.
                     */
                    TRACE_NUMBER_ERROR,
                    /** Code R72. A rare return reason. The dishonored return was sent too late. */
                    UNTIMELY_DISHONORED_RETURN,
                    /** Code R68. A rare return reason. The return was sent too late. */
                    UNTIMELY_RETURN,
                }

                /**
                 * An enum containing [ReturnReasonCode]'s known values, as well as an [_UNKNOWN]
                 * member.
                 *
                 * An instance of [ReturnReasonCode] 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 {
                    /**
                     * Code R01. Insufficient funds in the receiving account. Sometimes abbreviated
                     * to "NSF."
                     */
                    INSUFFICIENT_FUND,
                    /**
                     * Code R03. The account does not exist or the receiving bank was unable to
                     * locate it.
                     */
                    NO_ACCOUNT,
                    /** Code R02. The account is closed at the receiving bank. */
                    ACCOUNT_CLOSED,
                    /** Code R04. The account number is invalid at the receiving bank. */
                    INVALID_ACCOUNT_NUMBER_STRUCTURE,
                    /**
                     * Code R16. This return code has two separate meanings. (1) The receiving bank
                     * froze the account or (2) the Office of Foreign Assets Control (OFAC)
                     * instructed the receiving bank to return the entry.
                     */
                    ACCOUNT_FROZEN_ENTRY_RETURNED_PER_OFAC_INSTRUCTION,
                    /** Code R23. The receiving bank refused the credit transfer. */
                    CREDIT_ENTRY_REFUSED_BY_RECEIVER,
                    /**
                     * Code R05. The receiving bank rejected because of an incorrect Standard Entry
                     * Class code. Consumer accounts cannot be debited as
                     * `corporate_credit_or_debit` or `corporate_trade_exchange`.
                     */
                    UNAUTHORIZED_DEBIT_TO_CONSUMER_ACCOUNT_USING_CORPORATE_SEC_CODE,
                    /**
                     * Code R29. The corporate customer at the receiving bank reversed the transfer.
                     */
                    CORPORATE_CUSTOMER_ADVISED_NOT_AUTHORIZED,
                    /** Code R08. The receiving bank stopped payment on this transfer. */
                    PAYMENT_STOPPED,
                    /**
                     * Code R20. The account is not eligible for ACH, such as a savings account with
                     * transaction limits.
                     */
                    NON_TRANSACTION_ACCOUNT,
                    /**
                     * Code R09. The receiving bank account does not have enough available balance
                     * for the transfer.
                     */
                    UNCOLLECTED_FUNDS,
                    /** Code R28. The routing number is incorrect. */
                    ROUTING_NUMBER_CHECK_DIGIT_ERROR,
                    /** Code R10. The customer at the receiving bank reversed the transfer. */
                    CUSTOMER_ADVISED_UNAUTHORIZED_IMPROPER_INELIGIBLE_OR_INCOMPLETE,
                    /** Code R19. The amount field is incorrect or too large. */
                    AMOUNT_FIELD_ERROR,
                    /**
                     * Code R07. The customer revoked their authorization for a previously
                     * authorized transfer.
                     */
                    AUTHORIZATION_REVOKED_BY_CUSTOMER,
                    /** Code R13. The routing number is invalid. */
                    INVALID_ACH_ROUTING_NUMBER,
                    /**
                     * Code R17. This return code has multiple meanings. The receiving bank was
                     * either unable to process a field in the transfer, or believes the transfer
                     * was initiated under questionable circumstances (such as fraud), or identified
                     * an improperly-initiated reversing entry.
                     */
                    FILE_RECORD_EDIT_CRITERIA,
                    /** Code R45. A rare return reason. The individual name field was invalid. */
                    ENR_INVALID_INDIVIDUAL_NAME,
                    /**
                     * Code R06. The originating financial institution asked for this transfer to be
                     * returned. The receiving bank is complying with the request.
                     */
                    RETURNED_PER_ODFI_REQUEST,
                    /**
                     * Code R34. The receiving bank's regulatory supervisor has limited their
                     * participation in the ACH network.
                     */
                    LIMITED_PARTICIPATION_DFI,
                    /** Code R85. The outbound international ACH transfer was incorrect. */
                    INCORRECTLY_CODED_OUTBOUND_INTERNATIONAL_PAYMENT,
                    /** Code R12. A rare return reason. The account was sold to another bank. */
                    ACCOUNT_SOLD_TO_ANOTHER_DFI,
                    /** Code R25. The addenda record is incorrect or missing. */
                    ADDENDA_ERROR,
                    /** Code R15. A rare return reason. The account holder is deceased. */
                    BENEFICIARY_OR_ACCOUNT_HOLDER_DECEASED,
                    /**
                     * Code R11. A rare return reason. The customer authorized some payment to the
                     * sender, but this payment was not in error.
                     */
                    CUSTOMER_ADVISED_NOT_WITHIN_AUTHORIZATION_TERMS,
                    /**
                     * Code R74. A rare return reason. Sent in response to a return that was
                     * returned with code `field_error`. The latest return should include the
                     * corrected field(s).
                     */
                    CORRECTED_RETURN,
                    /**
                     * Code R24. A rare return reason. The receiving bank received an exact
                     * duplicate entry with the same trace number and amount.
                     */
                    DUPLICATE_ENTRY,
                    /**
                     * Code R67. A rare return reason. The return this message refers to was a
                     * duplicate.
                     */
                    DUPLICATE_RETURN,
                    /**
                     * Code R47. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    ENR_DUPLICATE_ENROLLMENT,
                    /**
                     * Code R43. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    ENR_INVALID_DFI_ACCOUNT_NUMBER,
                    /**
                     * Code R44. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    ENR_INVALID_INDIVIDUAL_ID_NUMBER,
                    /**
                     * Code R46. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    ENR_INVALID_REPRESENTATIVE_PAYEE_INDICATOR,
                    /**
                     * Code R41. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    ENR_INVALID_TRANSACTION_CODE,
                    /**
                     * Code R40. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    ENR_RETURN_OF_ENR_ENTRY,
                    /**
                     * Code R42. A rare return reason. Only used for US Government agency
                     * non-monetary automatic enrollment messages.
                     */
                    ENR_ROUTING_NUMBER_CHECK_DIGIT_ERROR,
                    /**
                     * Code R84. A rare return reason. The International ACH Transfer cannot be
                     * processed by the gateway.
                     */
                    ENTRY_NOT_PROCESSED_BY_GATEWAY,
                    /**
                     * Code R69. A rare return reason. One or more of the fields in the ACH were
                     * malformed.
                     */
                    FIELD_ERROR,
                    /**
                     * Code R83. A rare return reason. The Foreign receiving bank was unable to
                     * settle this ACH transfer.
                     */
                    FOREIGN_RECEIVING_DFI_UNABLE_TO_SETTLE,
                    /**
                     * Code R80. A rare return reason. The International ACH Transfer is malformed.
                     */
                    IAT_ENTRY_CODING_ERROR,
                    /**
                     * Code R18. A rare return reason. The ACH has an improper effective entry date
                     * field.
                     */
                    IMPROPER_EFFECTIVE_ENTRY_DATE,
                    /**
                     * Code R39. A rare return reason. The source document related to this ACH,
                     * usually an ACH check conversion, was presented to the bank.
                     */
                    IMPROPER_SOURCE_DOCUMENT_SOURCE_DOCUMENT_PRESENTED,
                    /**
                     * Code R21. A rare return reason. The Company ID field of the ACH was invalid.
                     */
                    INVALID_COMPANY_ID,
                    /**
                     * Code R82. A rare return reason. The foreign receiving bank identifier for an
                     * International ACH Transfer was invalid.
                     */
                    INVALID_FOREIGN_RECEIVING_DFI_IDENTIFICATION,
                    /**
                     * Code R22. A rare return reason. The Individual ID number field of the ACH was
                     * invalid.
                     */
                    INVALID_INDIVIDUAL_ID_NUMBER,
                    /**
                     * Code R53. A rare return reason. Both the Represented Check ("RCK") entry and
                     * the original check were presented to the bank.
                     */
                    ITEM_AND_RCK_ENTRY_PRESENTED_FOR_PAYMENT,
                    /**
                     * Code R51. A rare return reason. The Represented Check ("RCK") entry is
                     * ineligible.
                     */
                    ITEM_RELATED_TO_RCK_ENTRY_IS_INELIGIBLE,
                    /** Code R26. A rare return reason. The ACH is missing a required field. */
                    MANDATORY_FIELD_ERROR,
                    /**
                     * Code R71. A rare return reason. The receiving bank does not recognize the
                     * routing number in a dishonored return entry.
                     */
                    MISROUTED_DISHONORED_RETURN,
                    /**
                     * Code R61. A rare return reason. The receiving bank does not recognize the
                     * routing number in a return entry.
                     */
                    MISROUTED_RETURN,
                    /**
                     * Code R76. A rare return reason. Sent in response to a return, the bank does
                     * not find the errors alleged by the returning bank.
                     */
                    NO_ERRORS_FOUND,
                    /**
                     * Code R77. A rare return reason. The receiving bank does not accept the return
                     * of the erroneous debit. The funds are not available at the receiving bank.
                     */
                    NON_ACCEPTANCE_OF_R62_DISHONORED_RETURN,
                    /**
                     * Code R81. A rare return reason. The receiving bank does not accept
                     * International ACH Transfers.
                     */
                    NON_PARTICIPANT_IN_IAT_PROGRAM,
                    /**
                     * Code R31. A rare return reason. A return that has been agreed to be accepted
                     * by the receiving bank, despite falling outside of the usual return timeframe.
                     */
                    PERMISSIBLE_RETURN_ENTRY,
                    /**
                     * Code R70. A rare return reason. The receiving bank had not approved this
                     * return.
                     */
                    PERMISSIBLE_RETURN_ENTRY_NOT_ACCEPTED,
                    /**
                     * Code R32. A rare return reason. The receiving bank could not settle this
                     * transaction.
                     */
                    RDFI_NON_SETTLEMENT,
                    /**
                     * Code R30. A rare return reason. The receiving bank does not accept Check
                     * Truncation ACH transfers.
                     */
                    RDFI_PARTICIPANT_IN_CHECK_TRUNCATION_PROGRAM,
                    /** Code R14. A rare return reason. The payee is deceased. */
                    REPRESENTATIVE_PAYEE_DECEASED_OR_UNABLE_TO_CONTINUE_IN_THAT_CAPACITY,
                    /**
                     * Code R75. A rare return reason. The originating bank disputes that an earlier
                     * `duplicate_entry` return was actually a duplicate.
                     */
                    RETURN_NOT_A_DUPLICATE,
                    /**
                     * Code R62. A rare return reason. The originating financial institution made a
                     * mistake and this return corrects it.
                     */
                    RETURN_OF_ERRONEOUS_OR_REVERSING_DEBIT,
                    /** Code R36. A rare return reason. Return of a malformed credit entry. */
                    RETURN_OF_IMPROPER_CREDIT_ENTRY,
                    /** Code R35. A rare return reason. Return of a malformed debit entry. */
                    RETURN_OF_IMPROPER_DEBIT_ENTRY,
                    /**
                     * Code R33. A rare return reason. Return of a destroyed check ("XCK") entry.
                     */
                    RETURN_OF_XCK_ENTRY,
                    /**
                     * Code R37. A rare return reason. The source document related to this ACH,
                     * usually an ACH check conversion, was presented to the bank.
                     */
                    SOURCE_DOCUMENT_PRESENTED_FOR_PAYMENT,
                    /**
                     * Code R50. A rare return reason. State law prevents the bank from accepting
                     * the Represented Check ("RCK") entry.
                     */
                    STATE_LAW_AFFECTING_RCK_ACCEPTANCE,
                    /**
                     * Code R52. A rare return reason. A stop payment was issued on a Represented
                     * Check ("RCK") entry.
                     */
                    STOP_PAYMENT_ON_ITEM_RELATED_TO_RCK_ENTRY,
                    /**
                     * Code R38. A rare return reason. The source attached to the ACH, usually an
                     * ACH check conversion, includes a stop payment.
                     */
                    STOP_PAYMENT_ON_SOURCE_DOCUMENT,
                    /**
                     * Code R73. A rare return reason. The bank receiving an `untimely_return`
                     * believes it was on time.
                     */
                    TIMELY_ORIGINAL_RETURN,
                    /**
                     * Code R27. A rare return reason. An ACH return's trace number does not match
                     * an originated ACH.
                     */
                    TRACE_NUMBER_ERROR,
                    /** Code R72. A rare return reason. The dishonored return was sent too late. */
                    UNTIMELY_DISHONORED_RETURN,
                    /** Code R68. A rare return reason. The return was sent too late. */
                    UNTIMELY_RETURN,
                    /**
                     * An enum member indicating that [ReturnReasonCode] 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_FUND -> Value.INSUFFICIENT_FUND
                        NO_ACCOUNT -> Value.NO_ACCOUNT
                        ACCOUNT_CLOSED -> Value.ACCOUNT_CLOSED
                        INVALID_ACCOUNT_NUMBER_STRUCTURE -> Value.INVALID_ACCOUNT_NUMBER_STRUCTURE
                        ACCOUNT_FROZEN_ENTRY_RETURNED_PER_OFAC_INSTRUCTION ->
                            Value.ACCOUNT_FROZEN_ENTRY_RETURNED_PER_OFAC_INSTRUCTION
                        CREDIT_ENTRY_REFUSED_BY_RECEIVER -> Value.CREDIT_ENTRY_REFUSED_BY_RECEIVER
                        UNAUTHORIZED_DEBIT_TO_CONSUMER_ACCOUNT_USING_CORPORATE_SEC_CODE ->
                            Value.UNAUTHORIZED_DEBIT_TO_CONSUMER_ACCOUNT_USING_CORPORATE_SEC_CODE
                        CORPORATE_CUSTOMER_ADVISED_NOT_AUTHORIZED ->
                            Value.CORPORATE_CUSTOMER_ADVISED_NOT_AUTHORIZED
                        PAYMENT_STOPPED -> Value.PAYMENT_STOPPED
                        NON_TRANSACTION_ACCOUNT -> Value.NON_TRANSACTION_ACCOUNT
                        UNCOLLECTED_FUNDS -> Value.UNCOLLECTED_FUNDS
                        ROUTING_NUMBER_CHECK_DIGIT_ERROR -> Value.ROUTING_NUMBER_CHECK_DIGIT_ERROR
                        CUSTOMER_ADVISED_UNAUTHORIZED_IMPROPER_INELIGIBLE_OR_INCOMPLETE ->
                            Value.CUSTOMER_ADVISED_UNAUTHORIZED_IMPROPER_INELIGIBLE_OR_INCOMPLETE
                        AMOUNT_FIELD_ERROR -> Value.AMOUNT_FIELD_ERROR
                        AUTHORIZATION_REVOKED_BY_CUSTOMER -> Value.AUTHORIZATION_REVOKED_BY_CUSTOMER
                        INVALID_ACH_ROUTING_NUMBER -> Value.INVALID_ACH_ROUTING_NUMBER
                        FILE_RECORD_EDIT_CRITERIA -> Value.FILE_RECORD_EDIT_CRITERIA
                        ENR_INVALID_INDIVIDUAL_NAME -> Value.ENR_INVALID_INDIVIDUAL_NAME
                        RETURNED_PER_ODFI_REQUEST -> Value.RETURNED_PER_ODFI_REQUEST
                        LIMITED_PARTICIPATION_DFI -> Value.LIMITED_PARTICIPATION_DFI
                        INCORRECTLY_CODED_OUTBOUND_INTERNATIONAL_PAYMENT ->
                            Value.INCORRECTLY_CODED_OUTBOUND_INTERNATIONAL_PAYMENT
                        ACCOUNT_SOLD_TO_ANOTHER_DFI -> Value.ACCOUNT_SOLD_TO_ANOTHER_DFI
                        ADDENDA_ERROR -> Value.ADDENDA_ERROR
                        BENEFICIARY_OR_ACCOUNT_HOLDER_DECEASED ->
                            Value.BENEFICIARY_OR_ACCOUNT_HOLDER_DECEASED
                        CUSTOMER_ADVISED_NOT_WITHIN_AUTHORIZATION_TERMS ->
                            Value.CUSTOMER_ADVISED_NOT_WITHIN_AUTHORIZATION_TERMS
                        CORRECTED_RETURN -> Value.CORRECTED_RETURN
                        DUPLICATE_ENTRY -> Value.DUPLICATE_ENTRY
                        DUPLICATE_RETURN -> Value.DUPLICATE_RETURN
                        ENR_DUPLICATE_ENROLLMENT -> Value.ENR_DUPLICATE_ENROLLMENT
                        ENR_INVALID_DFI_ACCOUNT_NUMBER -> Value.ENR_INVALID_DFI_ACCOUNT_NUMBER
                        ENR_INVALID_INDIVIDUAL_ID_NUMBER -> Value.ENR_INVALID_INDIVIDUAL_ID_NUMBER
                        ENR_INVALID_REPRESENTATIVE_PAYEE_INDICATOR ->
                            Value.ENR_INVALID_REPRESENTATIVE_PAYEE_INDICATOR
                        ENR_INVALID_TRANSACTION_CODE -> Value.ENR_INVALID_TRANSACTION_CODE
                        ENR_RETURN_OF_ENR_ENTRY -> Value.ENR_RETURN_OF_ENR_ENTRY
                        ENR_ROUTING_NUMBER_CHECK_DIGIT_ERROR ->
                            Value.ENR_ROUTING_NUMBER_CHECK_DIGIT_ERROR
                        ENTRY_NOT_PROCESSED_BY_GATEWAY -> Value.ENTRY_NOT_PROCESSED_BY_GATEWAY
                        FIELD_ERROR -> Value.FIELD_ERROR
                        FOREIGN_RECEIVING_DFI_UNABLE_TO_SETTLE ->
                            Value.FOREIGN_RECEIVING_DFI_UNABLE_TO_SETTLE
                        IAT_ENTRY_CODING_ERROR -> Value.IAT_ENTRY_CODING_ERROR
                        IMPROPER_EFFECTIVE_ENTRY_DATE -> Value.IMPROPER_EFFECTIVE_ENTRY_DATE
                        IMPROPER_SOURCE_DOCUMENT_SOURCE_DOCUMENT_PRESENTED ->
                            Value.IMPROPER_SOURCE_DOCUMENT_SOURCE_DOCUMENT_PRESENTED
                        INVALID_COMPANY_ID -> Value.INVALID_COMPANY_ID
                        INVALID_FOREIGN_RECEIVING_DFI_IDENTIFICATION ->
                            Value.INVALID_FOREIGN_RECEIVING_DFI_IDENTIFICATION
                        INVALID_INDIVIDUAL_ID_NUMBER -> Value.INVALID_INDIVIDUAL_ID_NUMBER
                        ITEM_AND_RCK_ENTRY_PRESENTED_FOR_PAYMENT ->
                            Value.ITEM_AND_RCK_ENTRY_PRESENTED_FOR_PAYMENT
                        ITEM_RELATED_TO_RCK_ENTRY_IS_INELIGIBLE ->
                            Value.ITEM_RELATED_TO_RCK_ENTRY_IS_INELIGIBLE
                        MANDATORY_FIELD_ERROR -> Value.MANDATORY_FIELD_ERROR
                        MISROUTED_DISHONORED_RETURN -> Value.MISROUTED_DISHONORED_RETURN
                        MISROUTED_RETURN -> Value.MISROUTED_RETURN
                        NO_ERRORS_FOUND -> Value.NO_ERRORS_FOUND
                        NON_ACCEPTANCE_OF_R62_DISHONORED_RETURN ->
                            Value.NON_ACCEPTANCE_OF_R62_DISHONORED_RETURN
                        NON_PARTICIPANT_IN_IAT_PROGRAM -> Value.NON_PARTICIPANT_IN_IAT_PROGRAM
                        PERMISSIBLE_RETURN_ENTRY -> Value.PERMISSIBLE_RETURN_ENTRY
                        PERMISSIBLE_RETURN_ENTRY_NOT_ACCEPTED ->
                            Value.PERMISSIBLE_RETURN_ENTRY_NOT_ACCEPTED
                        RDFI_NON_SETTLEMENT -> Value.RDFI_NON_SETTLEMENT
                        RDFI_PARTICIPANT_IN_CHECK_TRUNCATION_PROGRAM ->
                            Value.RDFI_PARTICIPANT_IN_CHECK_TRUNCATION_PROGRAM
                        REPRESENTATIVE_PAYEE_DECEASED_OR_UNABLE_TO_CONTINUE_IN_THAT_CAPACITY ->
                            Value
                                .REPRESENTATIVE_PAYEE_DECEASED_OR_UNABLE_TO_CONTINUE_IN_THAT_CAPACITY
                        RETURN_NOT_A_DUPLICATE -> Value.RETURN_NOT_A_DUPLICATE
                        RETURN_OF_ERRONEOUS_OR_REVERSING_DEBIT ->
                            Value.RETURN_OF_ERRONEOUS_OR_REVERSING_DEBIT
                        RETURN_OF_IMPROPER_CREDIT_ENTRY -> Value.RETURN_OF_IMPROPER_CREDIT_ENTRY
                        RETURN_OF_IMPROPER_DEBIT_ENTRY -> Value.RETURN_OF_IMPROPER_DEBIT_ENTRY
                        RETURN_OF_XCK_ENTRY -> Value.RETURN_OF_XCK_ENTRY
                        SOURCE_DOCUMENT_PRESENTED_FOR_PAYMENT ->
                            Value.SOURCE_DOCUMENT_PRESENTED_FOR_PAYMENT
                        STATE_LAW_AFFECTING_RCK_ACCEPTANCE ->
                            Value.STATE_LAW_AFFECTING_RCK_ACCEPTANCE
                        STOP_PAYMENT_ON_ITEM_RELATED_TO_RCK_ENTRY ->
                            Value.STOP_PAYMENT_ON_ITEM_RELATED_TO_RCK_ENTRY
                        STOP_PAYMENT_ON_SOURCE_DOCUMENT -> Value.STOP_PAYMENT_ON_SOURCE_DOCUMENT
                        TIMELY_ORIGINAL_RETURN -> Value.TIMELY_ORIGINAL_RETURN
                        TRACE_NUMBER_ERROR -> Value.TRACE_NUMBER_ERROR
                        UNTIMELY_DISHONORED_RETURN -> Value.UNTIMELY_DISHONORED_RETURN
                        UNTIMELY_RETURN -> Value.UNTIMELY_RETURN
                        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_FUND -> Known.INSUFFICIENT_FUND
                        NO_ACCOUNT -> Known.NO_ACCOUNT
                        ACCOUNT_CLOSED -> Known.ACCOUNT_CLOSED
                        INVALID_ACCOUNT_NUMBER_STRUCTURE -> Known.INVALID_ACCOUNT_NUMBER_STRUCTURE
                        ACCOUNT_FROZEN_ENTRY_RETURNED_PER_OFAC_INSTRUCTION ->
                            Known.ACCOUNT_FROZEN_ENTRY_RETURNED_PER_OFAC_INSTRUCTION
                        CREDIT_ENTRY_REFUSED_BY_RECEIVER -> Known.CREDIT_ENTRY_REFUSED_BY_RECEIVER
                        UNAUTHORIZED_DEBIT_TO_CONSUMER_ACCOUNT_USING_CORPORATE_SEC_CODE ->
                            Known.UNAUTHORIZED_DEBIT_TO_CONSUMER_ACCOUNT_USING_CORPORATE_SEC_CODE
                        CORPORATE_CUSTOMER_ADVISED_NOT_AUTHORIZED ->
                            Known.CORPORATE_CUSTOMER_ADVISED_NOT_AUTHORIZED
                        PAYMENT_STOPPED -> Known.PAYMENT_STOPPED
                        NON_TRANSACTION_ACCOUNT -> Known.NON_TRANSACTION_ACCOUNT
                        UNCOLLECTED_FUNDS -> Known.UNCOLLECTED_FUNDS
                        ROUTING_NUMBER_CHECK_DIGIT_ERROR -> Known.ROUTING_NUMBER_CHECK_DIGIT_ERROR
                        CUSTOMER_ADVISED_UNAUTHORIZED_IMPROPER_INELIGIBLE_OR_INCOMPLETE ->
                            Known.CUSTOMER_ADVISED_UNAUTHORIZED_IMPROPER_INELIGIBLE_OR_INCOMPLETE
                        AMOUNT_FIELD_ERROR -> Known.AMOUNT_FIELD_ERROR
                        AUTHORIZATION_REVOKED_BY_CUSTOMER -> Known.AUTHORIZATION_REVOKED_BY_CUSTOMER
                        INVALID_ACH_ROUTING_NUMBER -> Known.INVALID_ACH_ROUTING_NUMBER
                        FILE_RECORD_EDIT_CRITERIA -> Known.FILE_RECORD_EDIT_CRITERIA
                        ENR_INVALID_INDIVIDUAL_NAME -> Known.ENR_INVALID_INDIVIDUAL_NAME
                        RETURNED_PER_ODFI_REQUEST -> Known.RETURNED_PER_ODFI_REQUEST
                        LIMITED_PARTICIPATION_DFI -> Known.LIMITED_PARTICIPATION_DFI
                        INCORRECTLY_CODED_OUTBOUND_INTERNATIONAL_PAYMENT ->
                            Known.INCORRECTLY_CODED_OUTBOUND_INTERNATIONAL_PAYMENT
                        ACCOUNT_SOLD_TO_ANOTHER_DFI -> Known.ACCOUNT_SOLD_TO_ANOTHER_DFI
                        ADDENDA_ERROR -> Known.ADDENDA_ERROR
                        BENEFICIARY_OR_ACCOUNT_HOLDER_DECEASED ->
                            Known.BENEFICIARY_OR_ACCOUNT_HOLDER_DECEASED
                        CUSTOMER_ADVISED_NOT_WITHIN_AUTHORIZATION_TERMS ->
                            Known.CUSTOMER_ADVISED_NOT_WITHIN_AUTHORIZATION_TERMS
                        CORRECTED_RETURN -> Known.CORRECTED_RETURN
                        DUPLICATE_ENTRY -> Known.DUPLICATE_ENTRY
                        DUPLICATE_RETURN -> Known.DUPLICATE_RETURN
                        ENR_DUPLICATE_ENROLLMENT -> Known.ENR_DUPLICATE_ENROLLMENT
                        ENR_INVALID_DFI_ACCOUNT_NUMBER -> Known.ENR_INVALID_DFI_ACCOUNT_NUMBER
                        ENR_INVALID_INDIVIDUAL_ID_NUMBER -> Known.ENR_INVALID_INDIVIDUAL_ID_NUMBER
                        ENR_INVALID_REPRESENTATIVE_PAYEE_INDICATOR ->
                            Known.ENR_INVALID_REPRESENTATIVE_PAYEE_INDICATOR
                        ENR_INVALID_TRANSACTION_CODE -> Known.ENR_INVALID_TRANSACTION_CODE
                        ENR_RETURN_OF_ENR_ENTRY -> Known.ENR_RETURN_OF_ENR_ENTRY
                        ENR_ROUTING_NUMBER_CHECK_DIGIT_ERROR ->
                            Known.ENR_ROUTING_NUMBER_CHECK_DIGIT_ERROR
                        ENTRY_NOT_PROCESSED_BY_GATEWAY -> Known.ENTRY_NOT_PROCESSED_BY_GATEWAY
                        FIELD_ERROR -> Known.FIELD_ERROR
                        FOREIGN_RECEIVING_DFI_UNABLE_TO_SETTLE ->
                            Known.FOREIGN_RECEIVING_DFI_UNABLE_TO_SETTLE
                        IAT_ENTRY_CODING_ERROR -> Known.IAT_ENTRY_CODING_ERROR
                        IMPROPER_EFFECTIVE_ENTRY_DATE -> Known.IMPROPER_EFFECTIVE_ENTRY_DATE
                        IMPROPER_SOURCE_DOCUMENT_SOURCE_DOCUMENT_PRESENTED ->
                            Known.IMPROPER_SOURCE_DOCUMENT_SOURCE_DOCUMENT_PRESENTED
                        INVALID_COMPANY_ID -> Known.INVALID_COMPANY_ID
                        INVALID_FOREIGN_RECEIVING_DFI_IDENTIFICATION ->
                            Known.INVALID_FOREIGN_RECEIVING_DFI_IDENTIFICATION
                        INVALID_INDIVIDUAL_ID_NUMBER -> Known.INVALID_INDIVIDUAL_ID_NUMBER
                        ITEM_AND_RCK_ENTRY_PRESENTED_FOR_PAYMENT ->
                            Known.ITEM_AND_RCK_ENTRY_PRESENTED_FOR_PAYMENT
                        ITEM_RELATED_TO_RCK_ENTRY_IS_INELIGIBLE ->
                            Known.ITEM_RELATED_TO_RCK_ENTRY_IS_INELIGIBLE
                        MANDATORY_FIELD_ERROR -> Known.MANDATORY_FIELD_ERROR
                        MISROUTED_DISHONORED_RETURN -> Known.MISROUTED_DISHONORED_RETURN
                        MISROUTED_RETURN -> Known.MISROUTED_RETURN
                        NO_ERRORS_FOUND -> Known.NO_ERRORS_FOUND
                        NON_ACCEPTANCE_OF_R62_DISHONORED_RETURN ->
                            Known.NON_ACCEPTANCE_OF_R62_DISHONORED_RETURN
                        NON_PARTICIPANT_IN_IAT_PROGRAM -> Known.NON_PARTICIPANT_IN_IAT_PROGRAM
                        PERMISSIBLE_RETURN_ENTRY -> Known.PERMISSIBLE_RETURN_ENTRY
                        PERMISSIBLE_RETURN_ENTRY_NOT_ACCEPTED ->
                            Known.PERMISSIBLE_RETURN_ENTRY_NOT_ACCEPTED
                        RDFI_NON_SETTLEMENT -> Known.RDFI_NON_SETTLEMENT
                        RDFI_PARTICIPANT_IN_CHECK_TRUNCATION_PROGRAM ->
                            Known.RDFI_PARTICIPANT_IN_CHECK_TRUNCATION_PROGRAM
                        REPRESENTATIVE_PAYEE_DECEASED_OR_UNABLE_TO_CONTINUE_IN_THAT_CAPACITY ->
                            Known
                                .REPRESENTATIVE_PAYEE_DECEASED_OR_UNABLE_TO_CONTINUE_IN_THAT_CAPACITY
                        RETURN_NOT_A_DUPLICATE -> Known.RETURN_NOT_A_DUPLICATE
                        RETURN_OF_ERRONEOUS_OR_REVERSING_DEBIT ->
                            Known.RETURN_OF_ERRONEOUS_OR_REVERSING_DEBIT
                        RETURN_OF_IMPROPER_CREDIT_ENTRY -> Known.RETURN_OF_IMPROPER_CREDIT_ENTRY
                        RETURN_OF_IMPROPER_DEBIT_ENTRY -> Known.RETURN_OF_IMPROPER_DEBIT_ENTRY
                        RETURN_OF_XCK_ENTRY -> Known.RETURN_OF_XCK_ENTRY
                        SOURCE_DOCUMENT_PRESENTED_FOR_PAYMENT ->
                            Known.SOURCE_DOCUMENT_PRESENTED_FOR_PAYMENT
                        STATE_LAW_AFFECTING_RCK_ACCEPTANCE ->
                            Known.STATE_LAW_AFFECTING_RCK_ACCEPTANCE
                        STOP_PAYMENT_ON_ITEM_RELATED_TO_RCK_ENTRY ->
                            Known.STOP_PAYMENT_ON_ITEM_RELATED_TO_RCK_ENTRY
                        STOP_PAYMENT_ON_SOURCE_DOCUMENT -> Known.STOP_PAYMENT_ON_SOURCE_DOCUMENT
                        TIMELY_ORIGINAL_RETURN -> Known.TIMELY_ORIGINAL_RETURN
                        TRACE_NUMBER_ERROR -> Known.TRACE_NUMBER_ERROR
                        UNTIMELY_DISHONORED_RETURN -> Known.UNTIMELY_DISHONORED_RETURN
                        UNTIMELY_RETURN -> Known.UNTIMELY_RETURN
                        else ->
                            throw IncreaseInvalidDataException("Unknown ReturnReasonCode: $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(): ReturnReasonCode = 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 ReturnReasonCode && 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 AchTransferReturn &&
                    addendaInformation == other.addendaInformation &&
                    createdAt == other.createdAt &&
                    rawReturnReasonCode == other.rawReturnReasonCode &&
                    returnReasonCode == other.returnReasonCode &&
                    traceNumber == other.traceNumber &&
                    transactionId == other.transactionId &&
                    transferId == other.transferId &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    addendaInformation,
                    createdAt,
                    rawReturnReasonCode,
                    returnReasonCode,
                    traceNumber,
                    transactionId,
                    transferId,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "AchTransferReturn{addendaInformation=$addendaInformation, createdAt=$createdAt, rawReturnReasonCode=$rawReturnReasonCode, returnReasonCode=$returnReasonCode, traceNumber=$traceNumber, transactionId=$transactionId, transferId=$transferId, additionalProperties=$additionalProperties}"
        }

        /**
         * A Blockchain Off-Ramp Transfer Settlement object. This field will be present in the JSON
         * response if and only if `category` is equal to `blockchain_offramp_transfer_settlement`.
         */
        class BlockchainOfframpTransferSettlement
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val sourceBlockchainAddressId: JsonField<String>,
            private val transferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("source_blockchain_address_id")
                @ExcludeMissing
                sourceBlockchainAddressId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transfer_id")
                @ExcludeMissing
                transferId: JsonField<String> = JsonMissing.of(),
            ) : this(sourceBlockchainAddressId, transferId, mutableMapOf())

            /**
             * The identifier of the Blockchain Address the funds were received at.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun sourceBlockchainAddressId(): String =
                sourceBlockchainAddressId.getRequired("source_blockchain_address_id")

            /**
             * The identifier of the Blockchain Off-Ramp Transfer that led to 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 transferId(): String = transferId.getRequired("transfer_id")

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

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

            @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
                 * [BlockchainOfframpTransferSettlement].
                 *
                 * The following fields are required:
                 * ```java
                 * .sourceBlockchainAddressId()
                 * .transferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

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

                @JvmSynthetic
                internal fun from(
                    blockchainOfframpTransferSettlement: BlockchainOfframpTransferSettlement
                ) = apply {
                    sourceBlockchainAddressId =
                        blockchainOfframpTransferSettlement.sourceBlockchainAddressId
                    transferId = blockchainOfframpTransferSettlement.transferId
                    additionalProperties =
                        blockchainOfframpTransferSettlement.additionalProperties.toMutableMap()
                }

                /** The identifier of the Blockchain Address the funds were received at. */
                fun sourceBlockchainAddressId(sourceBlockchainAddressId: String) =
                    sourceBlockchainAddressId(JsonField.of(sourceBlockchainAddressId))

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

                /**
                 * The identifier of the Blockchain Off-Ramp Transfer that led to this Transaction.
                 */
                fun transferId(transferId: String) = transferId(JsonField.of(transferId))

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

                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 [BlockchainOfframpTransferSettlement].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .sourceBlockchainAddressId()
                 * .transferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): BlockchainOfframpTransferSettlement =
                    BlockchainOfframpTransferSettlement(
                        checkRequired("sourceBlockchainAddressId", sourceBlockchainAddressId),
                        checkRequired("transferId", transferId),
                        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(): BlockchainOfframpTransferSettlement = apply {
                if (validated) {
                    return@apply
                }

                sourceBlockchainAddressId()
                transferId()
                validated = true
            }

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

            /**
             * Returns 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 (sourceBlockchainAddressId.asKnown().isPresent) 1 else 0) +
                    (if (transferId.asKnown().isPresent) 1 else 0)

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

                return other is BlockchainOfframpTransferSettlement &&
                    sourceBlockchainAddressId == other.sourceBlockchainAddressId &&
                    transferId == other.transferId &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "BlockchainOfframpTransferSettlement{sourceBlockchainAddressId=$sourceBlockchainAddressId, transferId=$transferId, additionalProperties=$additionalProperties}"
        }

        /**
         * A Blockchain On-Ramp Transfer Intention object. This field will be present in the JSON
         * response if and only if `category` is equal to `blockchain_onramp_transfer_intention`.
         */
        class BlockchainOnrampTransferIntention
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val destinationBlockchainAddress: JsonField<String>,
            private val transferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("destination_blockchain_address")
                @ExcludeMissing
                destinationBlockchainAddress: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transfer_id")
                @ExcludeMissing
                transferId: JsonField<String> = JsonMissing.of(),
            ) : this(destinationBlockchainAddress, transferId, mutableMapOf())

            /**
             * The blockchain address the funds were sent 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 destinationBlockchainAddress(): String =
                destinationBlockchainAddress.getRequired("destination_blockchain_address")

            /**
             * The identifier of the Blockchain On-Ramp Transfer that led to 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 transferId(): String = transferId.getRequired("transfer_id")

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

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

            @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
                 * [BlockchainOnrampTransferIntention].
                 *
                 * The following fields are required:
                 * ```java
                 * .destinationBlockchainAddress()
                 * .transferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

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

                @JvmSynthetic
                internal fun from(
                    blockchainOnrampTransferIntention: BlockchainOnrampTransferIntention
                ) = apply {
                    destinationBlockchainAddress =
                        blockchainOnrampTransferIntention.destinationBlockchainAddress
                    transferId = blockchainOnrampTransferIntention.transferId
                    additionalProperties =
                        blockchainOnrampTransferIntention.additionalProperties.toMutableMap()
                }

                /** The blockchain address the funds were sent to. */
                fun destinationBlockchainAddress(destinationBlockchainAddress: String) =
                    destinationBlockchainAddress(JsonField.of(destinationBlockchainAddress))

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

                /**
                 * The identifier of the Blockchain On-Ramp Transfer that led to this Transaction.
                 */
                fun transferId(transferId: String) = transferId(JsonField.of(transferId))

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

                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 [BlockchainOnrampTransferIntention].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .destinationBlockchainAddress()
                 * .transferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): BlockchainOnrampTransferIntention =
                    BlockchainOnrampTransferIntention(
                        checkRequired("destinationBlockchainAddress", destinationBlockchainAddress),
                        checkRequired("transferId", transferId),
                        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(): BlockchainOnrampTransferIntention = apply {
                if (validated) {
                    return@apply
                }

                destinationBlockchainAddress()
                transferId()
                validated = true
            }

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

            /**
             * Returns 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 (destinationBlockchainAddress.asKnown().isPresent) 1 else 0) +
                    (if (transferId.asKnown().isPresent) 1 else 0)

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

                return other is BlockchainOnrampTransferIntention &&
                    destinationBlockchainAddress == other.destinationBlockchainAddress &&
                    transferId == other.transferId &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "BlockchainOnrampTransferIntention{destinationBlockchainAddress=$destinationBlockchainAddress, transferId=$transferId, additionalProperties=$additionalProperties}"
        }

        /**
         * A Legacy Card Dispute Acceptance object. This field will be present in the JSON response
         * if and only if `category` is equal to `card_dispute_acceptance`. Contains the details of
         * a successful Card Dispute.
         */
        class CardDisputeAcceptance
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val acceptedAt: JsonField<OffsetDateTime>,
            private val transactionId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("accepted_at")
                @ExcludeMissing
                acceptedAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                @JsonProperty("transaction_id")
                @ExcludeMissing
                transactionId: JsonField<String> = JsonMissing.of(),
            ) : this(acceptedAt, transactionId, mutableMapOf())

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

            /**
             * The identifier of the Transaction that was created to return the disputed funds to
             * your account.
             *
             * @throws IncreaseInvalidDataException if 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")

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

            /**
             * 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
                 * [CardDisputeAcceptance].
                 *
                 * The following fields are required:
                 * ```java
                 * .acceptedAt()
                 * .transactionId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var acceptedAt: JsonField<OffsetDateTime>? = null
                private var transactionId: JsonField<String>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardDisputeAcceptance: CardDisputeAcceptance) = apply {
                    acceptedAt = cardDisputeAcceptance.acceptedAt
                    transactionId = cardDisputeAcceptance.transactionId
                    additionalProperties = cardDisputeAcceptance.additionalProperties.toMutableMap()
                }

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the
                 * Card Dispute was accepted.
                 */
                fun acceptedAt(acceptedAt: OffsetDateTime) = acceptedAt(JsonField.of(acceptedAt))

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

                /**
                 * The identifier of the Transaction that was created to return the disputed funds
                 * to your account.
                 */
                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
                }

                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 [CardDisputeAcceptance].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .acceptedAt()
                 * .transactionId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardDisputeAcceptance =
                    CardDisputeAcceptance(
                        checkRequired("acceptedAt", acceptedAt),
                        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(): CardDisputeAcceptance = apply {
                if (validated) {
                    return@apply
                }

                acceptedAt()
                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 (acceptedAt.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 CardDisputeAcceptance &&
                    acceptedAt == other.acceptedAt &&
                    transactionId == other.transactionId &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardDisputeAcceptance{acceptedAt=$acceptedAt, transactionId=$transactionId, additionalProperties=$additionalProperties}"
        }

        /**
         * A Card Dispute Financial object. This field will be present in the JSON response if and
         * only if `category` is equal to `card_dispute_financial`. Financial event related to a
         * Card Dispute.
         */
        class CardDisputeFinancial
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val amount: JsonField<Long>,
            private val network: JsonField<Network>,
            private val transactionId: JsonField<String>,
            private val visa: JsonField<Visa>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("network")
                @ExcludeMissing
                network: JsonField<Network> = JsonMissing.of(),
                @JsonProperty("transaction_id")
                @ExcludeMissing
                transactionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("visa") @ExcludeMissing visa: JsonField<Visa> = JsonMissing.of(),
            ) : this(amount, network, transactionId, visa, mutableMapOf())

            /**
             * The amount of the financial event.
             *
             * @throws IncreaseInvalidDataException if 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 network that the Card Dispute is associated 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 network(): Network = network.getRequired("network")

            /**
             * The identifier of the Transaction that was created to credit or debit the disputed
             * funds to or from your account.
             *
             * @throws IncreaseInvalidDataException if 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")

            /**
             * Information for events related to card dispute for card payments processed over
             * Visa's network. This field will be present in the JSON response if and only if
             * `network` is equal to `visa`.
             *
             * @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 [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 [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 [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 [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 [CardDisputeFinancial].
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .network()
                 * .transactionId()
                 * .visa()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var amount: JsonField<Long>? = null
                private var network: JsonField<Network>? = null
                private var transactionId: JsonField<String>? = null
                private var visa: JsonField<Visa>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardDisputeFinancial: CardDisputeFinancial) = apply {
                    amount = cardDisputeFinancial.amount
                    network = cardDisputeFinancial.network
                    transactionId = cardDisputeFinancial.transactionId
                    visa = cardDisputeFinancial.visa
                    additionalProperties = cardDisputeFinancial.additionalProperties.toMutableMap()
                }

                /** The amount of the financial event. */
                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 network that the Card Dispute is associated with. */
                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 }

                /**
                 * The identifier of the Transaction that was created to credit or debit the
                 * disputed funds to or from your account.
                 */
                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
                }

                /**
                 * Information for events related to card dispute for card payments processed over
                 * Visa's network. This field will be present in the JSON response if and only if
                 * `network` is equal to `visa`.
                 */
                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 [CardDisputeFinancial].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .network()
                 * .transactionId()
                 * .visa()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardDisputeFinancial =
                    CardDisputeFinancial(
                        checkRequired("amount", amount),
                        checkRequired("network", network),
                        checkRequired("transactionId", transactionId),
                        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(): CardDisputeFinancial = apply {
                if (validated) {
                    return@apply
                }

                amount()
                network().validate()
                transactionId()
                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 =
                (if (amount.asKnown().isPresent) 1 else 0) +
                    (network.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (transactionId.asKnown().isPresent) 1 else 0) +
                    (visa.asKnown().getOrNull()?.validity() ?: 0)

            /** The network that the Card Dispute is associated with. */
            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: details will be under the `visa` object. */
                    @JvmField val VISA = of("visa")

                    /** Pulse: details will be under the `pulse` object. */
                    @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: details will be under the `visa` object. */
                    VISA,
                    /** Pulse: details will be under the `pulse` object. */
                    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: details will be under the `visa` object. */
                    VISA,
                    /** Pulse: details will be under the `pulse` object. */
                    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()
            }

            /**
             * Information for events related to card dispute for card payments processed over
             * Visa's network. This field will be present in the JSON response if and only if
             * `network` is equal to `visa`.
             */
            class Visa
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val eventType: JsonField<EventType>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

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

                /**
                 * The type of card dispute financial event.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
                 *   is unexpectedly missing or null (e.g. if the server responded with an
                 *   unexpected value).
                 */
                fun eventType(): EventType = eventType.getRequired("event_type")

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

                @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
                     * .eventType()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

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

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

                    @JvmSynthetic
                    internal fun from(visa: Visa) = apply {
                        eventType = visa.eventType
                        additionalProperties = visa.additionalProperties.toMutableMap()
                    }

                    /** The type of card dispute financial event. */
                    fun eventType(eventType: EventType) = eventType(JsonField.of(eventType))

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

                    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
                     * .eventType()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): Visa =
                        Visa(
                            checkRequired("eventType", eventType),
                            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
                    }

                    eventType().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 = (eventType.asKnown().getOrNull()?.validity() ?: 0)

                /** The type of card dispute financial event. */
                class EventType
                @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 user's chargeback was submitted. */
                        @JvmField val CHARGEBACK_SUBMITTED = of("chargeback_submitted")

                        /** The user declined the merchant's pre-arbitration submission. */
                        @JvmField
                        val MERCHANT_PREARBITRATION_DECLINE_SUBMITTED =
                            of("merchant_prearbitration_decline_submitted")

                        /** The merchant's pre-arbitration submission was received. */
                        @JvmField
                        val MERCHANT_PREARBITRATION_RECEIVED =
                            of("merchant_prearbitration_received")

                        /** The transaction was re-presented by the merchant. */
                        @JvmField val REPRESENTED = of("represented")

                        /** The user's pre-arbitration was declined by the merchant. */
                        @JvmField
                        val USER_PREARBITRATION_DECLINE_RECEIVED =
                            of("user_prearbitration_decline_received")

                        /** The user's pre-arbitration was submitted. */
                        @JvmField
                        val USER_PREARBITRATION_SUBMITTED = of("user_prearbitration_submitted")

                        /** The user withdrew from the dispute. */
                        @JvmField val USER_WITHDRAWAL_SUBMITTED = of("user_withdrawal_submitted")

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

                    /** An enum containing [EventType]'s known values. */
                    enum class Known {
                        /** The user's chargeback was submitted. */
                        CHARGEBACK_SUBMITTED,
                        /** The user declined the merchant's pre-arbitration submission. */
                        MERCHANT_PREARBITRATION_DECLINE_SUBMITTED,
                        /** The merchant's pre-arbitration submission was received. */
                        MERCHANT_PREARBITRATION_RECEIVED,
                        /** The transaction was re-presented by the merchant. */
                        REPRESENTED,
                        /** The user's pre-arbitration was declined by the merchant. */
                        USER_PREARBITRATION_DECLINE_RECEIVED,
                        /** The user's pre-arbitration was submitted. */
                        USER_PREARBITRATION_SUBMITTED,
                        /** The user withdrew from the dispute. */
                        USER_WITHDRAWAL_SUBMITTED,
                    }

                    /**
                     * An enum containing [EventType]'s known values, as well as an [_UNKNOWN]
                     * member.
                     *
                     * An instance of [EventType] 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 user's chargeback was submitted. */
                        CHARGEBACK_SUBMITTED,
                        /** The user declined the merchant's pre-arbitration submission. */
                        MERCHANT_PREARBITRATION_DECLINE_SUBMITTED,
                        /** The merchant's pre-arbitration submission was received. */
                        MERCHANT_PREARBITRATION_RECEIVED,
                        /** The transaction was re-presented by the merchant. */
                        REPRESENTED,
                        /** The user's pre-arbitration was declined by the merchant. */
                        USER_PREARBITRATION_DECLINE_RECEIVED,
                        /** The user's pre-arbitration was submitted. */
                        USER_PREARBITRATION_SUBMITTED,
                        /** The user withdrew from the dispute. */
                        USER_WITHDRAWAL_SUBMITTED,
                        /**
                         * An enum member indicating that [EventType] 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) {
                            CHARGEBACK_SUBMITTED -> Value.CHARGEBACK_SUBMITTED
                            MERCHANT_PREARBITRATION_DECLINE_SUBMITTED ->
                                Value.MERCHANT_PREARBITRATION_DECLINE_SUBMITTED
                            MERCHANT_PREARBITRATION_RECEIVED ->
                                Value.MERCHANT_PREARBITRATION_RECEIVED
                            REPRESENTED -> Value.REPRESENTED
                            USER_PREARBITRATION_DECLINE_RECEIVED ->
                                Value.USER_PREARBITRATION_DECLINE_RECEIVED
                            USER_PREARBITRATION_SUBMITTED -> Value.USER_PREARBITRATION_SUBMITTED
                            USER_WITHDRAWAL_SUBMITTED -> Value.USER_WITHDRAWAL_SUBMITTED
                            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) {
                            CHARGEBACK_SUBMITTED -> Known.CHARGEBACK_SUBMITTED
                            MERCHANT_PREARBITRATION_DECLINE_SUBMITTED ->
                                Known.MERCHANT_PREARBITRATION_DECLINE_SUBMITTED
                            MERCHANT_PREARBITRATION_RECEIVED ->
                                Known.MERCHANT_PREARBITRATION_RECEIVED
                            REPRESENTED -> Known.REPRESENTED
                            USER_PREARBITRATION_DECLINE_RECEIVED ->
                                Known.USER_PREARBITRATION_DECLINE_RECEIVED
                            USER_PREARBITRATION_SUBMITTED -> Known.USER_PREARBITRATION_SUBMITTED
                            USER_WITHDRAWAL_SUBMITTED -> Known.USER_WITHDRAWAL_SUBMITTED
                            else -> throw IncreaseInvalidDataException("Unknown EventType: $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(): EventType = 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 EventType && 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 &&
                        eventType == other.eventType &&
                        additionalProperties == other.additionalProperties
                }

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

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "Visa{eventType=$eventType, additionalProperties=$additionalProperties}"
            }

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

                return other is CardDisputeFinancial &&
                    amount == other.amount &&
                    network == other.network &&
                    transactionId == other.transactionId &&
                    visa == other.visa &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(amount, network, transactionId, visa, additionalProperties)
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardDisputeFinancial{amount=$amount, network=$network, transactionId=$transactionId, visa=$visa, additionalProperties=$additionalProperties}"
        }

        /**
         * A Legacy Card Dispute Loss object. This field will be present in the JSON response if and
         * only if `category` is equal to `card_dispute_loss`. Contains the details of a lost Card
         * Dispute.
         */
        class CardDisputeLoss
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val explanation: JsonField<String>,
            private val lostAt: JsonField<OffsetDateTime>,
            private val transactionId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("explanation")
                @ExcludeMissing
                explanation: JsonField<String> = JsonMissing.of(),
                @JsonProperty("lost_at")
                @ExcludeMissing
                lostAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                @JsonProperty("transaction_id")
                @ExcludeMissing
                transactionId: JsonField<String> = JsonMissing.of(),
            ) : this(explanation, lostAt, transactionId, mutableMapOf())

            /**
             * Why the Card Dispute was lost.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun explanation(): String = explanation.getRequired("explanation")

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

            /**
             * The identifier of the Transaction that was created to debit the disputed funds from
             * your account.
             *
             * @throws IncreaseInvalidDataException if 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")

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

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

            /**
             * 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 [CardDisputeLoss].
                 *
                 * The following fields are required:
                 * ```java
                 * .explanation()
                 * .lostAt()
                 * .transactionId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var explanation: JsonField<String>? = null
                private var lostAt: JsonField<OffsetDateTime>? = null
                private var transactionId: JsonField<String>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardDisputeLoss: CardDisputeLoss) = apply {
                    explanation = cardDisputeLoss.explanation
                    lostAt = cardDisputeLoss.lostAt
                    transactionId = cardDisputeLoss.transactionId
                    additionalProperties = cardDisputeLoss.additionalProperties.toMutableMap()
                }

                /** Why the Card Dispute was lost. */
                fun explanation(explanation: String) = explanation(JsonField.of(explanation))

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

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the
                 * Card Dispute was lost.
                 */
                fun lostAt(lostAt: OffsetDateTime) = lostAt(JsonField.of(lostAt))

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

                /**
                 * The identifier of the Transaction that was created to debit the disputed funds
                 * from your account.
                 */
                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
                }

                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 [CardDisputeLoss].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .explanation()
                 * .lostAt()
                 * .transactionId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardDisputeLoss =
                    CardDisputeLoss(
                        checkRequired("explanation", explanation),
                        checkRequired("lostAt", lostAt),
                        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(): CardDisputeLoss = apply {
                if (validated) {
                    return@apply
                }

                explanation()
                lostAt()
                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 (explanation.asKnown().isPresent) 1 else 0) +
                    (if (lostAt.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 CardDisputeLoss &&
                    explanation == other.explanation &&
                    lostAt == other.lostAt &&
                    transactionId == other.transactionId &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardDisputeLoss{explanation=$explanation, lostAt=$lostAt, transactionId=$transactionId, 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 Push Transfer Acceptance object. This field will be present in the JSON response
         * if and only if `category` is equal to `card_push_transfer_acceptance`. A Card Push
         * Transfer Acceptance is created when an Outbound Card Push Transfer sent from Increase is
         * accepted by the receiving bank.
         */
        class CardPushTransferAcceptance
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val settlementAmount: JsonField<Long>,
            private val transferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("settlement_amount")
                @ExcludeMissing
                settlementAmount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("transfer_id")
                @ExcludeMissing
                transferId: JsonField<String> = JsonMissing.of(),
            ) : this(settlementAmount, transferId, mutableMapOf())

            /**
             * The transfer amount in USD 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 settlementAmount(): Long = settlementAmount.getRequired("settlement_amount")

            /**
             * The identifier of the Card Push Transfer that led to 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 transferId(): String = transferId.getRequired("transfer_id")

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

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

            @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
                 * [CardPushTransferAcceptance].
                 *
                 * The following fields are required:
                 * ```java
                 * .settlementAmount()
                 * .transferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var settlementAmount: JsonField<Long>? = null
                private var transferId: JsonField<String>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardPushTransferAcceptance: CardPushTransferAcceptance) = apply {
                    settlementAmount = cardPushTransferAcceptance.settlementAmount
                    transferId = cardPushTransferAcceptance.transferId
                    additionalProperties =
                        cardPushTransferAcceptance.additionalProperties.toMutableMap()
                }

                /** The transfer amount in USD cents. */
                fun settlementAmount(settlementAmount: Long) =
                    settlementAmount(JsonField.of(settlementAmount))

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

                /** The identifier of the Card Push Transfer that led to this Transaction. */
                fun transferId(transferId: String) = transferId(JsonField.of(transferId))

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

                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 [CardPushTransferAcceptance].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .settlementAmount()
                 * .transferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardPushTransferAcceptance =
                    CardPushTransferAcceptance(
                        checkRequired("settlementAmount", settlementAmount),
                        checkRequired("transferId", transferId),
                        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(): CardPushTransferAcceptance = apply {
                if (validated) {
                    return@apply
                }

                settlementAmount()
                transferId()
                validated = true
            }

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

            /**
             * Returns 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 (settlementAmount.asKnown().isPresent) 1 else 0) +
                    (if (transferId.asKnown().isPresent) 1 else 0)

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

                return other is CardPushTransferAcceptance &&
                    settlementAmount == other.settlementAmount &&
                    transferId == other.transferId &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardPushTransferAcceptance{settlementAmount=$settlementAmount, transferId=$transferId, 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 Revenue Payment object. This field will be present in the JSON response if and
         * only if `category` is equal to `card_revenue_payment`. Card Revenue Payments reflect
         * earnings from fees on card transactions.
         */
        class CardRevenuePayment
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val amount: JsonField<Long>,
            private val currency: JsonField<Currency>,
            private val periodEnd: JsonField<OffsetDateTime>,
            private val periodStart: JsonField<OffsetDateTime>,
            private val transactedOnAccountId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("period_end")
                @ExcludeMissing
                periodEnd: JsonField<OffsetDateTime> = JsonMissing.of(),
                @JsonProperty("period_start")
                @ExcludeMissing
                periodStart: JsonField<OffsetDateTime> = JsonMissing.of(),
                @JsonProperty("transacted_on_account_id")
                @ExcludeMissing
                transactedOnAccountId: JsonField<String> = JsonMissing.of(),
            ) : this(
                amount,
                currency,
                periodEnd,
                periodStart,
                transactedOnAccountId,
                mutableMapOf(),
            )

            /**
             * The 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction
             * 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 end of the period for which this transaction paid interest.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun periodEnd(): OffsetDateTime = periodEnd.getRequired("period_end")

            /**
             * The start of the period for which this transaction paid interest.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun periodStart(): OffsetDateTime = periodStart.getRequired("period_start")

            /**
             * The account the card belonged to.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun transactedOnAccountId(): Optional<String> =
                transactedOnAccountId.getOptional("transacted_on_account_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 [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 [periodEnd].
             *
             * Unlike [periodEnd], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("period_end")
            @ExcludeMissing
            fun _periodEnd(): JsonField<OffsetDateTime> = periodEnd

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

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

            @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 [CardRevenuePayment].
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .currency()
                 * .periodEnd()
                 * .periodStart()
                 * .transactedOnAccountId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var amount: JsonField<Long>? = null
                private var currency: JsonField<Currency>? = null
                private var periodEnd: JsonField<OffsetDateTime>? = null
                private var periodStart: JsonField<OffsetDateTime>? = null
                private var transactedOnAccountId: JsonField<String>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cardRevenuePayment: CardRevenuePayment) = apply {
                    amount = cardRevenuePayment.amount
                    currency = cardRevenuePayment.currency
                    periodEnd = cardRevenuePayment.periodEnd
                    periodStart = cardRevenuePayment.periodStart
                    transactedOnAccountId = cardRevenuePayment.transactedOnAccountId
                    additionalProperties = cardRevenuePayment.additionalProperties.toMutableMap()
                }

                /**
                 * The 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction
                 * 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 end of the period for which this transaction paid interest. */
                fun periodEnd(periodEnd: OffsetDateTime) = periodEnd(JsonField.of(periodEnd))

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

                /** The start of the period for which this transaction paid interest. */
                fun periodStart(periodStart: OffsetDateTime) =
                    periodStart(JsonField.of(periodStart))

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

                /** The account the card belonged to. */
                fun transactedOnAccountId(transactedOnAccountId: String?) =
                    transactedOnAccountId(JsonField.ofNullable(transactedOnAccountId))

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

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

                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 [CardRevenuePayment].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .currency()
                 * .periodEnd()
                 * .periodStart()
                 * .transactedOnAccountId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CardRevenuePayment =
                    CardRevenuePayment(
                        checkRequired("amount", amount),
                        checkRequired("currency", currency),
                        checkRequired("periodEnd", periodEnd),
                        checkRequired("periodStart", periodStart),
                        checkRequired("transactedOnAccountId", transactedOnAccountId),
                        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(): CardRevenuePayment = apply {
                if (validated) {
                    return@apply
                }

                amount()
                currency().validate()
                periodEnd()
                periodStart()
                transactedOnAccountId()
                validated = true
            }

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

            /**
             * Returns 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) +
                    (if (periodEnd.asKnown().isPresent) 1 else 0) +
                    (if (periodStart.asKnown().isPresent) 1 else 0) +
                    (if (transactedOnAccountId.asKnown().isPresent) 1 else 0)

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction
             * 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()
            }

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

                return other is CardRevenuePayment &&
                    amount == other.amount &&
                    currency == other.currency &&
                    periodEnd == other.periodEnd &&
                    periodStart == other.periodStart &&
                    transactedOnAccountId == other.transactedOnAccountId &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    amount,
                    currency,
                    periodEnd,
                    periodStart,
                    transactedOnAccountId,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CardRevenuePayment{amount=$amount, currency=$currency, periodEnd=$periodEnd, periodStart=$periodStart, transactedOnAccountId=$transactedOnAccountId, 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}"
        }

        /**
         * A Cashback Payment object. This field will be present in the JSON response if and only if
         * `category` is equal to `cashback_payment`. A Cashback Payment represents the cashback
         * paid to a cardholder for a given period. Cashback is usually paid monthly for the prior
         * month's transactions.
         */
        class CashbackPayment
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val accruedOnCardId: JsonField<String>,
            private val amount: JsonField<Long>,
            private val currency: JsonField<Currency>,
            private val periodEnd: JsonField<OffsetDateTime>,
            private val periodStart: JsonField<OffsetDateTime>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("accrued_on_card_id")
                @ExcludeMissing
                accruedOnCardId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("period_end")
                @ExcludeMissing
                periodEnd: JsonField<OffsetDateTime> = JsonMissing.of(),
                @JsonProperty("period_start")
                @ExcludeMissing
                periodStart: JsonField<OffsetDateTime> = JsonMissing.of(),
            ) : this(accruedOnCardId, amount, currency, periodEnd, periodStart, mutableMapOf())

            /**
             * The card on which the cashback was accrued.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun accruedOnCardId(): Optional<String> =
                accruedOnCardId.getOptional("accrued_on_card_id")

            /**
             * The 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction
             * 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 end of the period for which this transaction paid 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 periodEnd(): OffsetDateTime = periodEnd.getRequired("period_end")

            /**
             * The start of the period for which this transaction paid 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 periodStart(): OffsetDateTime = periodStart.getRequired("period_start")

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

            /**
             * 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<Currency> = currency

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

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

            @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 [CashbackPayment].
                 *
                 * The following fields are required:
                 * ```java
                 * .accruedOnCardId()
                 * .amount()
                 * .currency()
                 * .periodEnd()
                 * .periodStart()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var accruedOnCardId: JsonField<String>? = null
                private var amount: JsonField<Long>? = null
                private var currency: JsonField<Currency>? = null
                private var periodEnd: JsonField<OffsetDateTime>? = null
                private var periodStart: JsonField<OffsetDateTime>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(cashbackPayment: CashbackPayment) = apply {
                    accruedOnCardId = cashbackPayment.accruedOnCardId
                    amount = cashbackPayment.amount
                    currency = cashbackPayment.currency
                    periodEnd = cashbackPayment.periodEnd
                    periodStart = cashbackPayment.periodStart
                    additionalProperties = cashbackPayment.additionalProperties.toMutableMap()
                }

                /** The card on which the cashback was accrued. */
                fun accruedOnCardId(accruedOnCardId: String?) =
                    accruedOnCardId(JsonField.ofNullable(accruedOnCardId))

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

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

                /**
                 * The 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction
                 * 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 end of the period for which this transaction paid cashback. */
                fun periodEnd(periodEnd: OffsetDateTime) = periodEnd(JsonField.of(periodEnd))

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

                /** The start of the period for which this transaction paid cashback. */
                fun periodStart(periodStart: OffsetDateTime) =
                    periodStart(JsonField.of(periodStart))

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

                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 [CashbackPayment].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .accruedOnCardId()
                 * .amount()
                 * .currency()
                 * .periodEnd()
                 * .periodStart()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CashbackPayment =
                    CashbackPayment(
                        checkRequired("accruedOnCardId", accruedOnCardId),
                        checkRequired("amount", amount),
                        checkRequired("currency", currency),
                        checkRequired("periodEnd", periodEnd),
                        checkRequired("periodStart", periodStart),
                        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(): CashbackPayment = apply {
                if (validated) {
                    return@apply
                }

                accruedOnCardId()
                amount()
                currency().validate()
                periodEnd()
                periodStart()
                validated = true
            }

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

            /**
             * Returns 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 (accruedOnCardId.asKnown().isPresent) 1 else 0) +
                    (if (amount.asKnown().isPresent) 1 else 0) +
                    (currency.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (periodEnd.asKnown().isPresent) 1 else 0) +
                    (if (periodStart.asKnown().isPresent) 1 else 0)

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction
             * 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()
            }

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

                return other is CashbackPayment &&
                    accruedOnCardId == other.accruedOnCardId &&
                    amount == other.amount &&
                    currency == other.currency &&
                    periodEnd == other.periodEnd &&
                    periodStart == other.periodStart &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    accruedOnCardId,
                    amount,
                    currency,
                    periodEnd,
                    periodStart,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CashbackPayment{accruedOnCardId=$accruedOnCardId, amount=$amount, currency=$currency, periodEnd=$periodEnd, periodStart=$periodStart, additionalProperties=$additionalProperties}"
        }

        /**
         * A Check Deposit Acceptance object. This field will be present in the JSON response if and
         * only if `category` is equal to `check_deposit_acceptance`. A Check Deposit Acceptance is
         * created when a Check Deposit is processed and its details confirmed. Check Deposits may
         * be returned by the receiving bank, which will appear as a Check Deposit Return.
         */
        class CheckDepositAcceptance
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val accountNumber: JsonField<String>,
            private val amount: JsonField<Long>,
            private val auxiliaryOnUs: JsonField<String>,
            private val checkDepositId: JsonField<String>,
            private val currency: JsonField<Currency>,
            private val routingNumber: JsonField<String>,
            private val serialNumber: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("account_number")
                @ExcludeMissing
                accountNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("auxiliary_on_us")
                @ExcludeMissing
                auxiliaryOnUs: JsonField<String> = JsonMissing.of(),
                @JsonProperty("check_deposit_id")
                @ExcludeMissing
                checkDepositId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("routing_number")
                @ExcludeMissing
                routingNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("serial_number")
                @ExcludeMissing
                serialNumber: JsonField<String> = JsonMissing.of(),
            ) : this(
                accountNumber,
                amount,
                auxiliaryOnUs,
                checkDepositId,
                currency,
                routingNumber,
                serialNumber,
                mutableMapOf(),
            )

            /**
             * The account number printed on the check. This is an account at the bank that issued
             * the check.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun accountNumber(): String = accountNumber.getRequired("account_number")

            /**
             * The amount to be deposited 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")

            /**
             * An additional line of metadata printed on the check. This typically includes the
             * check number for business checks.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun auxiliaryOnUs(): Optional<String> = auxiliaryOnUs.getOptional("auxiliary_on_us")

            /**
             * The ID of the Check Deposit that was accepted.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun checkDepositId(): String = checkDepositId.getRequired("check_deposit_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")

            /**
             * The routing number printed on the check. This is a routing number for the bank that
             * issued the check.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun routingNumber(): String = routingNumber.getRequired("routing_number")

            /**
             * The check serial number, if present, for consumer checks. For business checks, the
             * serial number is usually in the `auxiliary_on_us` field.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun serialNumber(): Optional<String> = serialNumber.getOptional("serial_number")

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

            /**
             * 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 [auxiliaryOnUs].
             *
             * Unlike [auxiliaryOnUs], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("auxiliary_on_us")
            @ExcludeMissing
            fun _auxiliaryOnUs(): JsonField<String> = auxiliaryOnUs

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

            /**
             * 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 [routingNumber].
             *
             * Unlike [routingNumber], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("routing_number")
            @ExcludeMissing
            fun _routingNumber(): JsonField<String> = routingNumber

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

            @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
                 * [CheckDepositAcceptance].
                 *
                 * The following fields are required:
                 * ```java
                 * .accountNumber()
                 * .amount()
                 * .auxiliaryOnUs()
                 * .checkDepositId()
                 * .currency()
                 * .routingNumber()
                 * .serialNumber()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var accountNumber: JsonField<String>? = null
                private var amount: JsonField<Long>? = null
                private var auxiliaryOnUs: JsonField<String>? = null
                private var checkDepositId: JsonField<String>? = null
                private var currency: JsonField<Currency>? = null
                private var routingNumber: JsonField<String>? = null
                private var serialNumber: JsonField<String>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(checkDepositAcceptance: CheckDepositAcceptance) = apply {
                    accountNumber = checkDepositAcceptance.accountNumber
                    amount = checkDepositAcceptance.amount
                    auxiliaryOnUs = checkDepositAcceptance.auxiliaryOnUs
                    checkDepositId = checkDepositAcceptance.checkDepositId
                    currency = checkDepositAcceptance.currency
                    routingNumber = checkDepositAcceptance.routingNumber
                    serialNumber = checkDepositAcceptance.serialNumber
                    additionalProperties =
                        checkDepositAcceptance.additionalProperties.toMutableMap()
                }

                /**
                 * The account number printed on the check. This is an account at the bank that
                 * issued the check.
                 */
                fun accountNumber(accountNumber: String) =
                    accountNumber(JsonField.of(accountNumber))

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

                /**
                 * The amount to be deposited 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 }

                /**
                 * An additional line of metadata printed on the check. This typically includes the
                 * check number for business checks.
                 */
                fun auxiliaryOnUs(auxiliaryOnUs: String?) =
                    auxiliaryOnUs(JsonField.ofNullable(auxiliaryOnUs))

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

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

                /** The ID of the Check Deposit that was accepted. */
                fun checkDepositId(checkDepositId: String) =
                    checkDepositId(JsonField.of(checkDepositId))

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

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

                /**
                 * The routing number printed on the check. This is a routing number for the bank
                 * that issued the check.
                 */
                fun routingNumber(routingNumber: String) =
                    routingNumber(JsonField.of(routingNumber))

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

                /**
                 * The check serial number, if present, for consumer checks. For business checks,
                 * the serial number is usually in the `auxiliary_on_us` field.
                 */
                fun serialNumber(serialNumber: String?) =
                    serialNumber(JsonField.ofNullable(serialNumber))

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

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

                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 [CheckDepositAcceptance].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .accountNumber()
                 * .amount()
                 * .auxiliaryOnUs()
                 * .checkDepositId()
                 * .currency()
                 * .routingNumber()
                 * .serialNumber()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CheckDepositAcceptance =
                    CheckDepositAcceptance(
                        checkRequired("accountNumber", accountNumber),
                        checkRequired("amount", amount),
                        checkRequired("auxiliaryOnUs", auxiliaryOnUs),
                        checkRequired("checkDepositId", checkDepositId),
                        checkRequired("currency", currency),
                        checkRequired("routingNumber", routingNumber),
                        checkRequired("serialNumber", serialNumber),
                        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(): CheckDepositAcceptance = apply {
                if (validated) {
                    return@apply
                }

                accountNumber()
                amount()
                auxiliaryOnUs()
                checkDepositId()
                currency().validate()
                routingNumber()
                serialNumber()
                validated = true
            }

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

            /**
             * Returns 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 (accountNumber.asKnown().isPresent) 1 else 0) +
                    (if (amount.asKnown().isPresent) 1 else 0) +
                    (if (auxiliaryOnUs.asKnown().isPresent) 1 else 0) +
                    (if (checkDepositId.asKnown().isPresent) 1 else 0) +
                    (currency.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (routingNumber.asKnown().isPresent) 1 else 0) +
                    (if (serialNumber.asKnown().isPresent) 1 else 0)

            /**
             * 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()
            }

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

                return other is CheckDepositAcceptance &&
                    accountNumber == other.accountNumber &&
                    amount == other.amount &&
                    auxiliaryOnUs == other.auxiliaryOnUs &&
                    checkDepositId == other.checkDepositId &&
                    currency == other.currency &&
                    routingNumber == other.routingNumber &&
                    serialNumber == other.serialNumber &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    accountNumber,
                    amount,
                    auxiliaryOnUs,
                    checkDepositId,
                    currency,
                    routingNumber,
                    serialNumber,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CheckDepositAcceptance{accountNumber=$accountNumber, amount=$amount, auxiliaryOnUs=$auxiliaryOnUs, checkDepositId=$checkDepositId, currency=$currency, routingNumber=$routingNumber, serialNumber=$serialNumber, additionalProperties=$additionalProperties}"
        }

        /**
         * A Check Deposit Return object. This field will be present in the JSON response if and
         * only if `category` is equal to `check_deposit_return`. A Check Deposit Return is created
         * when a Check Deposit is returned by the bank holding the account it was drawn against.
         * Check Deposits may be returned for a variety of reasons, including insufficient funds or
         * a mismatched account number. Usually, checks are returned within the first 7 days after
         * the deposit is made.
         */
        class CheckDepositReturn
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val amount: JsonField<Long>,
            private val checkDepositId: JsonField<String>,
            private val currency: JsonField<Currency>,
            private val returnReason: JsonField<ReturnReason>,
            private val returnedAt: JsonField<OffsetDateTime>,
            private val transactionId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("check_deposit_id")
                @ExcludeMissing
                checkDepositId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("return_reason")
                @ExcludeMissing
                returnReason: JsonField<ReturnReason> = JsonMissing.of(),
                @JsonProperty("returned_at")
                @ExcludeMissing
                returnedAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                @JsonProperty("transaction_id")
                @ExcludeMissing
                transactionId: JsonField<String> = JsonMissing.of(),
            ) : this(
                amount,
                checkDepositId,
                currency,
                returnReason,
                returnedAt,
                transactionId,
                mutableMapOf(),
            )

            /**
             * The returned amount in USD 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 of the Check Deposit that was returned.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun checkDepositId(): String = checkDepositId.getRequired("check_deposit_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")

            /**
             * Why this check was returned by the bank holding the account it was drawn 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 returnReason(): ReturnReason = returnReason.getRequired("return_reason")

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

            /**
             * The identifier of the transaction that reversed the original check deposit
             * 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")

            /**
             * 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 [checkDepositId].
             *
             * Unlike [checkDepositId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("check_deposit_id")
            @ExcludeMissing
            fun _checkDepositId(): JsonField<String> = checkDepositId

            /**
             * 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 [returnReason].
             *
             * Unlike [returnReason], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("return_reason")
            @ExcludeMissing
            fun _returnReason(): JsonField<ReturnReason> = returnReason

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

            /**
             * 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 [CheckDepositReturn].
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .checkDepositId()
                 * .currency()
                 * .returnReason()
                 * .returnedAt()
                 * .transactionId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var amount: JsonField<Long>? = null
                private var checkDepositId: JsonField<String>? = null
                private var currency: JsonField<Currency>? = null
                private var returnReason: JsonField<ReturnReason>? = null
                private var returnedAt: JsonField<OffsetDateTime>? = null
                private var transactionId: JsonField<String>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(checkDepositReturn: CheckDepositReturn) = apply {
                    amount = checkDepositReturn.amount
                    checkDepositId = checkDepositReturn.checkDepositId
                    currency = checkDepositReturn.currency
                    returnReason = checkDepositReturn.returnReason
                    returnedAt = checkDepositReturn.returnedAt
                    transactionId = checkDepositReturn.transactionId
                    additionalProperties = checkDepositReturn.additionalProperties.toMutableMap()
                }

                /** The returned amount in USD 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 of the Check Deposit that was returned. */
                fun checkDepositId(checkDepositId: String) =
                    checkDepositId(JsonField.of(checkDepositId))

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

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

                /**
                 * Why this check was returned by the bank holding the account it was drawn against.
                 */
                fun returnReason(returnReason: ReturnReason) =
                    returnReason(JsonField.of(returnReason))

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

                /**
                 * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the
                 * check deposit was returned.
                 */
                fun returnedAt(returnedAt: OffsetDateTime) = returnedAt(JsonField.of(returnedAt))

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

                /**
                 * The identifier of the transaction that reversed the original check deposit
                 * 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
                }

                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 [CheckDepositReturn].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .checkDepositId()
                 * .currency()
                 * .returnReason()
                 * .returnedAt()
                 * .transactionId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CheckDepositReturn =
                    CheckDepositReturn(
                        checkRequired("amount", amount),
                        checkRequired("checkDepositId", checkDepositId),
                        checkRequired("currency", currency),
                        checkRequired("returnReason", returnReason),
                        checkRequired("returnedAt", returnedAt),
                        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(): CheckDepositReturn = apply {
                if (validated) {
                    return@apply
                }

                amount()
                checkDepositId()
                currency().validate()
                returnReason().validate()
                returnedAt()
                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 (amount.asKnown().isPresent) 1 else 0) +
                    (if (checkDepositId.asKnown().isPresent) 1 else 0) +
                    (currency.asKnown().getOrNull()?.validity() ?: 0) +
                    (returnReason.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (returnedAt.asKnown().isPresent) 1 else 0) +
                    (if (transactionId.asKnown().isPresent) 1 else 0)

            /**
             * 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()
            }

            /** Why this check was returned by the bank holding the account it was drawn against. */
            class ReturnReason
            @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 check doesn't allow ACH conversion. */
                    @JvmField val ACH_CONVERSION_NOT_SUPPORTED = of("ach_conversion_not_supported")

                    /** The account is closed. (Check21 return code `D`) */
                    @JvmField val CLOSED_ACCOUNT = of("closed_account")

                    /** The check has already been deposited. (Check21 return code `Y`) */
                    @JvmField val DUPLICATE_SUBMISSION = of("duplicate_submission")

                    /** Insufficient funds (Check21 return code `A`) */
                    @JvmField val INSUFFICIENT_FUNDS = of("insufficient_funds")

                    /**
                     * No account was found matching the check details. (Check21 return code `E`)
                     */
                    @JvmField val NO_ACCOUNT = of("no_account")

                    /** The check was not authorized. (Check21 return code `Q`) */
                    @JvmField val NOT_AUTHORIZED = of("not_authorized")

                    /** The check is too old. (Check21 return code `G`) */
                    @JvmField val STALE_DATED = of("stale_dated")

                    /**
                     * The payment has been stopped by the account holder. (Check21 return code `C`)
                     */
                    @JvmField val STOP_PAYMENT = of("stop_payment")

                    /** The reason for the return is unknown. */
                    @JvmField val UNKNOWN_REASON = of("unknown_reason")

                    /** The image doesn't match the details submitted. */
                    @JvmField val UNMATCHED_DETAILS = of("unmatched_details")

                    /** The image could not be read. (Check21 return code `U`) */
                    @JvmField val UNREADABLE_IMAGE = of("unreadable_image")

                    /** The check endorsement was irregular. (Check21 return code `J`) */
                    @JvmField val ENDORSEMENT_IRREGULAR = of("endorsement_irregular")

                    /** The check present was either altered or fake. (Check21 return code `N`) */
                    @JvmField val ALTERED_OR_FICTITIOUS_ITEM = of("altered_or_fictitious_item")

                    /** The account this check is drawn on is frozen. (Check21 return code `F`) */
                    @JvmField val FROZEN_OR_BLOCKED_ACCOUNT = of("frozen_or_blocked_account")

                    /** The check is post dated. (Check21 return code `H`) */
                    @JvmField val POST_DATED = of("post_dated")

                    /** The endorsement was missing. (Check21 return code `I`) */
                    @JvmField val ENDORSEMENT_MISSING = of("endorsement_missing")

                    /** The check signature was missing. (Check21 return code `K`) */
                    @JvmField val SIGNATURE_MISSING = of("signature_missing")

                    /**
                     * The bank suspects a stop payment will be placed. (Check21 return code `T`)
                     */
                    @JvmField val STOP_PAYMENT_SUSPECT = of("stop_payment_suspect")

                    /** The bank cannot read the image. (Check21 return code `U`) */
                    @JvmField val UNUSABLE_IMAGE = of("unusable_image")

                    /**
                     * The check image fails the bank's security check. (Check21 return code `V`)
                     */
                    @JvmField val IMAGE_FAILS_SECURITY_CHECK = of("image_fails_security_check")

                    /** The bank cannot determine the amount. (Check21 return code `W`) */
                    @JvmField val CANNOT_DETERMINE_AMOUNT = of("cannot_determine_amount")

                    /**
                     * The signature is inconsistent with prior signatures. (Check21 return code
                     * `L`)
                     */
                    @JvmField val SIGNATURE_IRREGULAR = of("signature_irregular")

                    /**
                     * The check is a non-cash item and cannot be drawn against the account.
                     * (Check21 return code `M`)
                     */
                    @JvmField val NON_CASH_ITEM = of("non_cash_item")

                    /** The bank is unable to process this check. (Check21 return code `O`) */
                    @JvmField val UNABLE_TO_PROCESS = of("unable_to_process")

                    /** The check exceeds the bank or customer's limit. (Check21 return code `P`) */
                    @JvmField val ITEM_EXCEEDS_DOLLAR_LIMIT = of("item_exceeds_dollar_limit")

                    /**
                     * The bank sold this account and no longer services this customer. (Check21
                     * return code `R`)
                     */
                    @JvmField val BRANCH_OR_ACCOUNT_SOLD = of("branch_or_account_sold")

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

                /** An enum containing [ReturnReason]'s known values. */
                enum class Known {
                    /** The check doesn't allow ACH conversion. */
                    ACH_CONVERSION_NOT_SUPPORTED,
                    /** The account is closed. (Check21 return code `D`) */
                    CLOSED_ACCOUNT,
                    /** The check has already been deposited. (Check21 return code `Y`) */
                    DUPLICATE_SUBMISSION,
                    /** Insufficient funds (Check21 return code `A`) */
                    INSUFFICIENT_FUNDS,
                    /**
                     * No account was found matching the check details. (Check21 return code `E`)
                     */
                    NO_ACCOUNT,
                    /** The check was not authorized. (Check21 return code `Q`) */
                    NOT_AUTHORIZED,
                    /** The check is too old. (Check21 return code `G`) */
                    STALE_DATED,
                    /**
                     * The payment has been stopped by the account holder. (Check21 return code `C`)
                     */
                    STOP_PAYMENT,
                    /** The reason for the return is unknown. */
                    UNKNOWN_REASON,
                    /** The image doesn't match the details submitted. */
                    UNMATCHED_DETAILS,
                    /** The image could not be read. (Check21 return code `U`) */
                    UNREADABLE_IMAGE,
                    /** The check endorsement was irregular. (Check21 return code `J`) */
                    ENDORSEMENT_IRREGULAR,
                    /** The check present was either altered or fake. (Check21 return code `N`) */
                    ALTERED_OR_FICTITIOUS_ITEM,
                    /** The account this check is drawn on is frozen. (Check21 return code `F`) */
                    FROZEN_OR_BLOCKED_ACCOUNT,
                    /** The check is post dated. (Check21 return code `H`) */
                    POST_DATED,
                    /** The endorsement was missing. (Check21 return code `I`) */
                    ENDORSEMENT_MISSING,
                    /** The check signature was missing. (Check21 return code `K`) */
                    SIGNATURE_MISSING,
                    /**
                     * The bank suspects a stop payment will be placed. (Check21 return code `T`)
                     */
                    STOP_PAYMENT_SUSPECT,
                    /** The bank cannot read the image. (Check21 return code `U`) */
                    UNUSABLE_IMAGE,
                    /**
                     * The check image fails the bank's security check. (Check21 return code `V`)
                     */
                    IMAGE_FAILS_SECURITY_CHECK,
                    /** The bank cannot determine the amount. (Check21 return code `W`) */
                    CANNOT_DETERMINE_AMOUNT,
                    /**
                     * The signature is inconsistent with prior signatures. (Check21 return code
                     * `L`)
                     */
                    SIGNATURE_IRREGULAR,
                    /**
                     * The check is a non-cash item and cannot be drawn against the account.
                     * (Check21 return code `M`)
                     */
                    NON_CASH_ITEM,
                    /** The bank is unable to process this check. (Check21 return code `O`) */
                    UNABLE_TO_PROCESS,
                    /** The check exceeds the bank or customer's limit. (Check21 return code `P`) */
                    ITEM_EXCEEDS_DOLLAR_LIMIT,
                    /**
                     * The bank sold this account and no longer services this customer. (Check21
                     * return code `R`)
                     */
                    BRANCH_OR_ACCOUNT_SOLD,
                }

                /**
                 * An enum containing [ReturnReason]'s known values, as well as an [_UNKNOWN]
                 * member.
                 *
                 * An instance of [ReturnReason] 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 check doesn't allow ACH conversion. */
                    ACH_CONVERSION_NOT_SUPPORTED,
                    /** The account is closed. (Check21 return code `D`) */
                    CLOSED_ACCOUNT,
                    /** The check has already been deposited. (Check21 return code `Y`) */
                    DUPLICATE_SUBMISSION,
                    /** Insufficient funds (Check21 return code `A`) */
                    INSUFFICIENT_FUNDS,
                    /**
                     * No account was found matching the check details. (Check21 return code `E`)
                     */
                    NO_ACCOUNT,
                    /** The check was not authorized. (Check21 return code `Q`) */
                    NOT_AUTHORIZED,
                    /** The check is too old. (Check21 return code `G`) */
                    STALE_DATED,
                    /**
                     * The payment has been stopped by the account holder. (Check21 return code `C`)
                     */
                    STOP_PAYMENT,
                    /** The reason for the return is unknown. */
                    UNKNOWN_REASON,
                    /** The image doesn't match the details submitted. */
                    UNMATCHED_DETAILS,
                    /** The image could not be read. (Check21 return code `U`) */
                    UNREADABLE_IMAGE,
                    /** The check endorsement was irregular. (Check21 return code `J`) */
                    ENDORSEMENT_IRREGULAR,
                    /** The check present was either altered or fake. (Check21 return code `N`) */
                    ALTERED_OR_FICTITIOUS_ITEM,
                    /** The account this check is drawn on is frozen. (Check21 return code `F`) */
                    FROZEN_OR_BLOCKED_ACCOUNT,
                    /** The check is post dated. (Check21 return code `H`) */
                    POST_DATED,
                    /** The endorsement was missing. (Check21 return code `I`) */
                    ENDORSEMENT_MISSING,
                    /** The check signature was missing. (Check21 return code `K`) */
                    SIGNATURE_MISSING,
                    /**
                     * The bank suspects a stop payment will be placed. (Check21 return code `T`)
                     */
                    STOP_PAYMENT_SUSPECT,
                    /** The bank cannot read the image. (Check21 return code `U`) */
                    UNUSABLE_IMAGE,
                    /**
                     * The check image fails the bank's security check. (Check21 return code `V`)
                     */
                    IMAGE_FAILS_SECURITY_CHECK,
                    /** The bank cannot determine the amount. (Check21 return code `W`) */
                    CANNOT_DETERMINE_AMOUNT,
                    /**
                     * The signature is inconsistent with prior signatures. (Check21 return code
                     * `L`)
                     */
                    SIGNATURE_IRREGULAR,
                    /**
                     * The check is a non-cash item and cannot be drawn against the account.
                     * (Check21 return code `M`)
                     */
                    NON_CASH_ITEM,
                    /** The bank is unable to process this check. (Check21 return code `O`) */
                    UNABLE_TO_PROCESS,
                    /** The check exceeds the bank or customer's limit. (Check21 return code `P`) */
                    ITEM_EXCEEDS_DOLLAR_LIMIT,
                    /**
                     * The bank sold this account and no longer services this customer. (Check21
                     * return code `R`)
                     */
                    BRANCH_OR_ACCOUNT_SOLD,
                    /**
                     * An enum member indicating that [ReturnReason] 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) {
                        ACH_CONVERSION_NOT_SUPPORTED -> Value.ACH_CONVERSION_NOT_SUPPORTED
                        CLOSED_ACCOUNT -> Value.CLOSED_ACCOUNT
                        DUPLICATE_SUBMISSION -> Value.DUPLICATE_SUBMISSION
                        INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS
                        NO_ACCOUNT -> Value.NO_ACCOUNT
                        NOT_AUTHORIZED -> Value.NOT_AUTHORIZED
                        STALE_DATED -> Value.STALE_DATED
                        STOP_PAYMENT -> Value.STOP_PAYMENT
                        UNKNOWN_REASON -> Value.UNKNOWN_REASON
                        UNMATCHED_DETAILS -> Value.UNMATCHED_DETAILS
                        UNREADABLE_IMAGE -> Value.UNREADABLE_IMAGE
                        ENDORSEMENT_IRREGULAR -> Value.ENDORSEMENT_IRREGULAR
                        ALTERED_OR_FICTITIOUS_ITEM -> Value.ALTERED_OR_FICTITIOUS_ITEM
                        FROZEN_OR_BLOCKED_ACCOUNT -> Value.FROZEN_OR_BLOCKED_ACCOUNT
                        POST_DATED -> Value.POST_DATED
                        ENDORSEMENT_MISSING -> Value.ENDORSEMENT_MISSING
                        SIGNATURE_MISSING -> Value.SIGNATURE_MISSING
                        STOP_PAYMENT_SUSPECT -> Value.STOP_PAYMENT_SUSPECT
                        UNUSABLE_IMAGE -> Value.UNUSABLE_IMAGE
                        IMAGE_FAILS_SECURITY_CHECK -> Value.IMAGE_FAILS_SECURITY_CHECK
                        CANNOT_DETERMINE_AMOUNT -> Value.CANNOT_DETERMINE_AMOUNT
                        SIGNATURE_IRREGULAR -> Value.SIGNATURE_IRREGULAR
                        NON_CASH_ITEM -> Value.NON_CASH_ITEM
                        UNABLE_TO_PROCESS -> Value.UNABLE_TO_PROCESS
                        ITEM_EXCEEDS_DOLLAR_LIMIT -> Value.ITEM_EXCEEDS_DOLLAR_LIMIT
                        BRANCH_OR_ACCOUNT_SOLD -> Value.BRANCH_OR_ACCOUNT_SOLD
                        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) {
                        ACH_CONVERSION_NOT_SUPPORTED -> Known.ACH_CONVERSION_NOT_SUPPORTED
                        CLOSED_ACCOUNT -> Known.CLOSED_ACCOUNT
                        DUPLICATE_SUBMISSION -> Known.DUPLICATE_SUBMISSION
                        INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS
                        NO_ACCOUNT -> Known.NO_ACCOUNT
                        NOT_AUTHORIZED -> Known.NOT_AUTHORIZED
                        STALE_DATED -> Known.STALE_DATED
                        STOP_PAYMENT -> Known.STOP_PAYMENT
                        UNKNOWN_REASON -> Known.UNKNOWN_REASON
                        UNMATCHED_DETAILS -> Known.UNMATCHED_DETAILS
                        UNREADABLE_IMAGE -> Known.UNREADABLE_IMAGE
                        ENDORSEMENT_IRREGULAR -> Known.ENDORSEMENT_IRREGULAR
                        ALTERED_OR_FICTITIOUS_ITEM -> Known.ALTERED_OR_FICTITIOUS_ITEM
                        FROZEN_OR_BLOCKED_ACCOUNT -> Known.FROZEN_OR_BLOCKED_ACCOUNT
                        POST_DATED -> Known.POST_DATED
                        ENDORSEMENT_MISSING -> Known.ENDORSEMENT_MISSING
                        SIGNATURE_MISSING -> Known.SIGNATURE_MISSING
                        STOP_PAYMENT_SUSPECT -> Known.STOP_PAYMENT_SUSPECT
                        UNUSABLE_IMAGE -> Known.UNUSABLE_IMAGE
                        IMAGE_FAILS_SECURITY_CHECK -> Known.IMAGE_FAILS_SECURITY_CHECK
                        CANNOT_DETERMINE_AMOUNT -> Known.CANNOT_DETERMINE_AMOUNT
                        SIGNATURE_IRREGULAR -> Known.SIGNATURE_IRREGULAR
                        NON_CASH_ITEM -> Known.NON_CASH_ITEM
                        UNABLE_TO_PROCESS -> Known.UNABLE_TO_PROCESS
                        ITEM_EXCEEDS_DOLLAR_LIMIT -> Known.ITEM_EXCEEDS_DOLLAR_LIMIT
                        BRANCH_OR_ACCOUNT_SOLD -> Known.BRANCH_OR_ACCOUNT_SOLD
                        else -> throw IncreaseInvalidDataException("Unknown ReturnReason: $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(): ReturnReason = 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 ReturnReason && 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 CheckDepositReturn &&
                    amount == other.amount &&
                    checkDepositId == other.checkDepositId &&
                    currency == other.currency &&
                    returnReason == other.returnReason &&
                    returnedAt == other.returnedAt &&
                    transactionId == other.transactionId &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    amount,
                    checkDepositId,
                    currency,
                    returnReason,
                    returnedAt,
                    transactionId,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CheckDepositReturn{amount=$amount, checkDepositId=$checkDepositId, currency=$currency, returnReason=$returnReason, returnedAt=$returnedAt, transactionId=$transactionId, additionalProperties=$additionalProperties}"
        }

        /**
         * A Check Transfer Deposit object. This field will be present in the JSON response if and
         * only if `category` is equal to `check_transfer_deposit`. An Inbound Check is a check
         * drawn on an Increase account that has been deposited by an external bank account. These
         * types of checks are not pre-registered.
         */
        class CheckTransferDeposit
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val backImageFileId: JsonField<String>,
            private val bankOfFirstDepositRoutingNumber: JsonField<String>,
            private val depositedAt: JsonField<OffsetDateTime>,
            private val frontImageFileId: JsonField<String>,
            private val inboundCheckDepositId: JsonField<String>,
            private val transactionId: JsonField<String>,
            private val transferId: JsonField<String>,
            private val type: JsonField<Type>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("back_image_file_id")
                @ExcludeMissing
                backImageFileId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("bank_of_first_deposit_routing_number")
                @ExcludeMissing
                bankOfFirstDepositRoutingNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("deposited_at")
                @ExcludeMissing
                depositedAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                @JsonProperty("front_image_file_id")
                @ExcludeMissing
                frontImageFileId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("inbound_check_deposit_id")
                @ExcludeMissing
                inboundCheckDepositId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transaction_id")
                @ExcludeMissing
                transactionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transfer_id")
                @ExcludeMissing
                transferId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
            ) : this(
                backImageFileId,
                bankOfFirstDepositRoutingNumber,
                depositedAt,
                frontImageFileId,
                inboundCheckDepositId,
                transactionId,
                transferId,
                type,
                mutableMapOf(),
            )

            /**
             * The identifier of the API File object containing an image of the back of the
             * deposited check.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun backImageFileId(): Optional<String> =
                backImageFileId.getOptional("back_image_file_id")

            /**
             * The American Bankers' Association (ABA) Routing Transit Number (RTN) for the bank
             * depositing this check. In some rare cases, this is not transmitted via Check21 and
             * the value will be null.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun bankOfFirstDepositRoutingNumber(): Optional<String> =
                bankOfFirstDepositRoutingNumber.getOptional("bank_of_first_deposit_routing_number")

            /**
             * When the check was deposited.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun depositedAt(): OffsetDateTime = depositedAt.getRequired("deposited_at")

            /**
             * The identifier of the API File object containing an image of the front of the
             * deposited check.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun frontImageFileId(): Optional<String> =
                frontImageFileId.getOptional("front_image_file_id")

            /**
             * The identifier of the Inbound Check Deposit object 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 inboundCheckDepositId(): Optional<String> =
                inboundCheckDepositId.getOptional("inbound_check_deposit_id")

            /**
             * The identifier of the Transaction object created when the check was deposited.
             *
             * @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")

            /**
             * The identifier of the Check Transfer object that was deposited.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun transferId(): Optional<String> = transferId.getOptional("transfer_id")

            /**
             * A constant representing the object's type. For this resource it will always be
             * `check_transfer_deposit`.
             *
             * @throws IncreaseInvalidDataException if 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 [backImageFileId].
             *
             * Unlike [backImageFileId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("back_image_file_id")
            @ExcludeMissing
            fun _backImageFileId(): JsonField<String> = backImageFileId

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

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

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

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

            /**
             * 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 [transferId].
             *
             * Unlike [transferId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("transfer_id")
            @ExcludeMissing
            fun _transferId(): JsonField<String> = transferId

            /**
             * 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 [CheckTransferDeposit].
                 *
                 * The following fields are required:
                 * ```java
                 * .backImageFileId()
                 * .bankOfFirstDepositRoutingNumber()
                 * .depositedAt()
                 * .frontImageFileId()
                 * .inboundCheckDepositId()
                 * .transactionId()
                 * .transferId()
                 * .type()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var backImageFileId: JsonField<String>? = null
                private var bankOfFirstDepositRoutingNumber: JsonField<String>? = null
                private var depositedAt: JsonField<OffsetDateTime>? = null
                private var frontImageFileId: JsonField<String>? = null
                private var inboundCheckDepositId: JsonField<String>? = null
                private var transactionId: JsonField<String>? = null
                private var transferId: JsonField<String>? = null
                private var type: JsonField<Type>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(checkTransferDeposit: CheckTransferDeposit) = apply {
                    backImageFileId = checkTransferDeposit.backImageFileId
                    bankOfFirstDepositRoutingNumber =
                        checkTransferDeposit.bankOfFirstDepositRoutingNumber
                    depositedAt = checkTransferDeposit.depositedAt
                    frontImageFileId = checkTransferDeposit.frontImageFileId
                    inboundCheckDepositId = checkTransferDeposit.inboundCheckDepositId
                    transactionId = checkTransferDeposit.transactionId
                    transferId = checkTransferDeposit.transferId
                    type = checkTransferDeposit.type
                    additionalProperties = checkTransferDeposit.additionalProperties.toMutableMap()
                }

                /**
                 * The identifier of the API File object containing an image of the back of the
                 * deposited check.
                 */
                fun backImageFileId(backImageFileId: String?) =
                    backImageFileId(JsonField.ofNullable(backImageFileId))

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

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

                /**
                 * The American Bankers' Association (ABA) Routing Transit Number (RTN) for the bank
                 * depositing this check. In some rare cases, this is not transmitted via Check21
                 * and the value will be null.
                 */
                fun bankOfFirstDepositRoutingNumber(bankOfFirstDepositRoutingNumber: String?) =
                    bankOfFirstDepositRoutingNumber(
                        JsonField.ofNullable(bankOfFirstDepositRoutingNumber)
                    )

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

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

                /** When the check was deposited. */
                fun depositedAt(depositedAt: OffsetDateTime) =
                    depositedAt(JsonField.of(depositedAt))

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

                /**
                 * The identifier of the API File object containing an image of the front of the
                 * deposited check.
                 */
                fun frontImageFileId(frontImageFileId: String?) =
                    frontImageFileId(JsonField.ofNullable(frontImageFileId))

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

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

                /**
                 * The identifier of the Inbound Check Deposit object associated with this
                 * transaction.
                 */
                fun inboundCheckDepositId(inboundCheckDepositId: String?) =
                    inboundCheckDepositId(JsonField.ofNullable(inboundCheckDepositId))

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

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

                /**
                 * The identifier of the Transaction object created when the check was deposited.
                 */
                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
                }

                /** The identifier of the Check Transfer object that was deposited. */
                fun transferId(transferId: String?) = transferId(JsonField.ofNullable(transferId))

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

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

                /**
                 * A constant representing the object's type. For this resource it will always be
                 * `check_transfer_deposit`.
                 */
                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 [CheckTransferDeposit].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .backImageFileId()
                 * .bankOfFirstDepositRoutingNumber()
                 * .depositedAt()
                 * .frontImageFileId()
                 * .inboundCheckDepositId()
                 * .transactionId()
                 * .transferId()
                 * .type()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): CheckTransferDeposit =
                    CheckTransferDeposit(
                        checkRequired("backImageFileId", backImageFileId),
                        checkRequired(
                            "bankOfFirstDepositRoutingNumber",
                            bankOfFirstDepositRoutingNumber,
                        ),
                        checkRequired("depositedAt", depositedAt),
                        checkRequired("frontImageFileId", frontImageFileId),
                        checkRequired("inboundCheckDepositId", inboundCheckDepositId),
                        checkRequired("transactionId", transactionId),
                        checkRequired("transferId", transferId),
                        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(): CheckTransferDeposit = apply {
                if (validated) {
                    return@apply
                }

                backImageFileId()
                bankOfFirstDepositRoutingNumber()
                depositedAt()
                frontImageFileId()
                inboundCheckDepositId()
                transactionId()
                transferId()
                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 (backImageFileId.asKnown().isPresent) 1 else 0) +
                    (if (bankOfFirstDepositRoutingNumber.asKnown().isPresent) 1 else 0) +
                    (if (depositedAt.asKnown().isPresent) 1 else 0) +
                    (if (frontImageFileId.asKnown().isPresent) 1 else 0) +
                    (if (inboundCheckDepositId.asKnown().isPresent) 1 else 0) +
                    (if (transactionId.asKnown().isPresent) 1 else 0) +
                    (if (transferId.asKnown().isPresent) 1 else 0) +
                    (type.asKnown().getOrNull()?.validity() ?: 0)

            /**
             * A constant representing the object's type. For this resource it will always be
             * `check_transfer_deposit`.
             */
            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 CHECK_TRANSFER_DEPOSIT = of("check_transfer_deposit")

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

                /** An enum containing [Type]'s known values. */
                enum class Known {
                    CHECK_TRANSFER_DEPOSIT
                }

                /**
                 * 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 {
                    CHECK_TRANSFER_DEPOSIT,
                    /**
                     * 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) {
                        CHECK_TRANSFER_DEPOSIT -> Value.CHECK_TRANSFER_DEPOSIT
                        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) {
                        CHECK_TRANSFER_DEPOSIT -> Known.CHECK_TRANSFER_DEPOSIT
                        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 CheckTransferDeposit &&
                    backImageFileId == other.backImageFileId &&
                    bankOfFirstDepositRoutingNumber == other.bankOfFirstDepositRoutingNumber &&
                    depositedAt == other.depositedAt &&
                    frontImageFileId == other.frontImageFileId &&
                    inboundCheckDepositId == other.inboundCheckDepositId &&
                    transactionId == other.transactionId &&
                    transferId == other.transferId &&
                    type == other.type &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    backImageFileId,
                    bankOfFirstDepositRoutingNumber,
                    depositedAt,
                    frontImageFileId,
                    inboundCheckDepositId,
                    transactionId,
                    transferId,
                    type,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "CheckTransferDeposit{backImageFileId=$backImageFileId, bankOfFirstDepositRoutingNumber=$bankOfFirstDepositRoutingNumber, depositedAt=$depositedAt, frontImageFileId=$frontImageFileId, inboundCheckDepositId=$inboundCheckDepositId, transactionId=$transactionId, transferId=$transferId, type=$type, additionalProperties=$additionalProperties}"
        }

        /**
         * A FedNow Transfer Acknowledgement object. This field will be present in the JSON response
         * if and only if `category` is equal to `fednow_transfer_acknowledgement`. A FedNow
         * Transfer Acknowledgement is created when a FedNow Transfer sent from Increase is
         * acknowledged by the receiving bank.
         */
        class FednowTransferAcknowledgement
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val transferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

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

            /**
             * The identifier of the FedNow Transfer that led to 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 transferId(): String = transferId.getRequired("transfer_id")

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

            @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
                 * [FednowTransferAcknowledgement].
                 *
                 * The following fields are required:
                 * ```java
                 * .transferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

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

                @JvmSynthetic
                internal fun from(fednowTransferAcknowledgement: FednowTransferAcknowledgement) =
                    apply {
                        transferId = fednowTransferAcknowledgement.transferId
                        additionalProperties =
                            fednowTransferAcknowledgement.additionalProperties.toMutableMap()
                    }

                /** The identifier of the FedNow Transfer that led to this Transaction. */
                fun transferId(transferId: String) = transferId(JsonField.of(transferId))

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

                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 [FednowTransferAcknowledgement].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .transferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): FednowTransferAcknowledgement =
                    FednowTransferAcknowledgement(
                        checkRequired("transferId", transferId),
                        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(): FednowTransferAcknowledgement = apply {
                if (validated) {
                    return@apply
                }

                transferId()
                validated = true
            }

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

            /**
             * Returns 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 (transferId.asKnown().isPresent) 1 else 0)

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

                return other is FednowTransferAcknowledgement &&
                    transferId == other.transferId &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "FednowTransferAcknowledgement{transferId=$transferId, additionalProperties=$additionalProperties}"
        }

        /**
         * A Fee Payment object. This field will be present in the JSON response if and only if
         * `category` is equal to `fee_payment`. A Fee Payment represents a payment made to
         * Increase.
         */
        class FeePayment
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val amount: JsonField<Long>,
            private val currency: JsonField<Currency>,
            private val feePeriodStart: JsonField<LocalDate>,
            private val programId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("fee_period_start")
                @ExcludeMissing
                feePeriodStart: JsonField<LocalDate> = JsonMissing.of(),
                @JsonProperty("program_id")
                @ExcludeMissing
                programId: JsonField<String> = JsonMissing.of(),
            ) : this(amount, currency, feePeriodStart, programId, mutableMapOf())

            /**
             * The 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction
             * 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 start of this payment's fee period, usually the first day of a month.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun feePeriodStart(): LocalDate = feePeriodStart.getRequired("fee_period_start")

            /**
             * The Program for which this fee was incurred.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun programId(): Optional<String> = programId.getOptional("program_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 [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 [feePeriodStart].
             *
             * Unlike [feePeriodStart], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("fee_period_start")
            @ExcludeMissing
            fun _feePeriodStart(): JsonField<LocalDate> = feePeriodStart

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

            @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 [FeePayment].
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .currency()
                 * .feePeriodStart()
                 * .programId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var amount: JsonField<Long>? = null
                private var currency: JsonField<Currency>? = null
                private var feePeriodStart: JsonField<LocalDate>? = null
                private var programId: JsonField<String>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(feePayment: FeePayment) = apply {
                    amount = feePayment.amount
                    currency = feePayment.currency
                    feePeriodStart = feePayment.feePeriodStart
                    programId = feePayment.programId
                    additionalProperties = feePayment.additionalProperties.toMutableMap()
                }

                /**
                 * The 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction
                 * 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 start of this payment's fee period, usually the first day of a month. */
                fun feePeriodStart(feePeriodStart: LocalDate) =
                    feePeriodStart(JsonField.of(feePeriodStart))

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

                /** The Program for which this fee was incurred. */
                fun programId(programId: String?) = programId(JsonField.ofNullable(programId))

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

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

                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 [FeePayment].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .currency()
                 * .feePeriodStart()
                 * .programId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): FeePayment =
                    FeePayment(
                        checkRequired("amount", amount),
                        checkRequired("currency", currency),
                        checkRequired("feePeriodStart", feePeriodStart),
                        checkRequired("programId", programId),
                        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(): FeePayment = apply {
                if (validated) {
                    return@apply
                }

                amount()
                currency().validate()
                feePeriodStart()
                programId()
                validated = true
            }

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

            /**
             * Returns 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) +
                    (if (feePeriodStart.asKnown().isPresent) 1 else 0) +
                    (if (programId.asKnown().isPresent) 1 else 0)

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction
             * 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()
            }

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

                return other is FeePayment &&
                    amount == other.amount &&
                    currency == other.currency &&
                    feePeriodStart == other.feePeriodStart &&
                    programId == other.programId &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(amount, currency, feePeriodStart, programId, additionalProperties)
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "FeePayment{amount=$amount, currency=$currency, feePeriodStart=$feePeriodStart, programId=$programId, additionalProperties=$additionalProperties}"
        }

        /**
         * An Inbound ACH Transfer Intention object. This field will be present in the JSON response
         * if and only if `category` is equal to `inbound_ach_transfer`. An Inbound ACH Transfer
         * Intention is created when an ACH transfer is initiated at another bank and received by
         * Increase.
         */
        class InboundAchTransfer
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val addenda: JsonField<Addenda>,
            private val amount: JsonField<Long>,
            private val originatorCompanyDescriptiveDate: JsonField<String>,
            private val originatorCompanyDiscretionaryData: JsonField<String>,
            private val originatorCompanyEntryDescription: JsonField<String>,
            private val originatorCompanyId: JsonField<String>,
            private val originatorCompanyName: JsonField<String>,
            private val receiverIdNumber: JsonField<String>,
            private val receiverName: JsonField<String>,
            private val traceNumber: JsonField<String>,
            private val transferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("addenda")
                @ExcludeMissing
                addenda: JsonField<Addenda> = JsonMissing.of(),
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("originator_company_descriptive_date")
                @ExcludeMissing
                originatorCompanyDescriptiveDate: JsonField<String> = JsonMissing.of(),
                @JsonProperty("originator_company_discretionary_data")
                @ExcludeMissing
                originatorCompanyDiscretionaryData: JsonField<String> = JsonMissing.of(),
                @JsonProperty("originator_company_entry_description")
                @ExcludeMissing
                originatorCompanyEntryDescription: JsonField<String> = JsonMissing.of(),
                @JsonProperty("originator_company_id")
                @ExcludeMissing
                originatorCompanyId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("originator_company_name")
                @ExcludeMissing
                originatorCompanyName: JsonField<String> = JsonMissing.of(),
                @JsonProperty("receiver_id_number")
                @ExcludeMissing
                receiverIdNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("receiver_name")
                @ExcludeMissing
                receiverName: JsonField<String> = JsonMissing.of(),
                @JsonProperty("trace_number")
                @ExcludeMissing
                traceNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transfer_id")
                @ExcludeMissing
                transferId: JsonField<String> = JsonMissing.of(),
            ) : this(
                addenda,
                amount,
                originatorCompanyDescriptiveDate,
                originatorCompanyDiscretionaryData,
                originatorCompanyEntryDescription,
                originatorCompanyId,
                originatorCompanyName,
                receiverIdNumber,
                receiverName,
                traceNumber,
                transferId,
                mutableMapOf(),
            )

            /**
             * Additional information sent from the originator.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun addenda(): Optional<Addenda> = addenda.getOptional("addenda")

            /**
             * The transfer amount in USD 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 description of the date of the transfer, usually in the format `YYMMDD`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun originatorCompanyDescriptiveDate(): Optional<String> =
                originatorCompanyDescriptiveDate.getOptional("originator_company_descriptive_date")

            /**
             * Data set by the originator.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun originatorCompanyDiscretionaryData(): Optional<String> =
                originatorCompanyDiscretionaryData.getOptional(
                    "originator_company_discretionary_data"
                )

            /**
             * An informational description of the transfer.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun originatorCompanyEntryDescription(): String =
                originatorCompanyEntryDescription.getRequired(
                    "originator_company_entry_description"
                )

            /**
             * An identifier for the originating company. This is generally, but not always, a
             * stable identifier across multiple transfers.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun originatorCompanyId(): String =
                originatorCompanyId.getRequired("originator_company_id")

            /**
             * A name set by the originator to identify themselves.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun originatorCompanyName(): String =
                originatorCompanyName.getRequired("originator_company_name")

            /**
             * The originator's identifier for the transfer recipient.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun receiverIdNumber(): Optional<String> =
                receiverIdNumber.getOptional("receiver_id_number")

            /**
             * The name of the transfer recipient. This value is informational and not verified by
             * Increase.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun receiverName(): Optional<String> = receiverName.getOptional("receiver_name")

            /**
             * A 15 digit number recorded in the Nacha file and available to both the originating
             * and receiving bank. Along with the amount, date, and originating routing number, this
             * can be used to identify the ACH transfer at either bank. ACH trace numbers are not
             * unique, but are
             * [used to correlate returns](https://increase.com/documentation/ach-returns#ach-returns).
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun traceNumber(): String = traceNumber.getRequired("trace_number")

            /**
             * The Inbound ACH Transfer's 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 transferId(): String = transferId.getRequired("transfer_id")

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

            /**
             * 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 [originatorCompanyDescriptiveDate].
             *
             * Unlike [originatorCompanyDescriptiveDate], this method doesn't throw if the JSON
             * field has an unexpected type.
             */
            @JsonProperty("originator_company_descriptive_date")
            @ExcludeMissing
            fun _originatorCompanyDescriptiveDate(): JsonField<String> =
                originatorCompanyDescriptiveDate

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

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

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

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

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

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

            /**
             * 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 [transferId].
             *
             * Unlike [transferId], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("transfer_id")
            @ExcludeMissing
            fun _transferId(): JsonField<String> = transferId

            @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 [InboundAchTransfer].
                 *
                 * The following fields are required:
                 * ```java
                 * .addenda()
                 * .amount()
                 * .originatorCompanyDescriptiveDate()
                 * .originatorCompanyDiscretionaryData()
                 * .originatorCompanyEntryDescription()
                 * .originatorCompanyId()
                 * .originatorCompanyName()
                 * .receiverIdNumber()
                 * .receiverName()
                 * .traceNumber()
                 * .transferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var addenda: JsonField<Addenda>? = null
                private var amount: JsonField<Long>? = null
                private var originatorCompanyDescriptiveDate: JsonField<String>? = null
                private var originatorCompanyDiscretionaryData: JsonField<String>? = null
                private var originatorCompanyEntryDescription: JsonField<String>? = null
                private var originatorCompanyId: JsonField<String>? = null
                private var originatorCompanyName: JsonField<String>? = null
                private var receiverIdNumber: JsonField<String>? = null
                private var receiverName: JsonField<String>? = null
                private var traceNumber: JsonField<String>? = null
                private var transferId: JsonField<String>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(inboundAchTransfer: InboundAchTransfer) = apply {
                    addenda = inboundAchTransfer.addenda
                    amount = inboundAchTransfer.amount
                    originatorCompanyDescriptiveDate =
                        inboundAchTransfer.originatorCompanyDescriptiveDate
                    originatorCompanyDiscretionaryData =
                        inboundAchTransfer.originatorCompanyDiscretionaryData
                    originatorCompanyEntryDescription =
                        inboundAchTransfer.originatorCompanyEntryDescription
                    originatorCompanyId = inboundAchTransfer.originatorCompanyId
                    originatorCompanyName = inboundAchTransfer.originatorCompanyName
                    receiverIdNumber = inboundAchTransfer.receiverIdNumber
                    receiverName = inboundAchTransfer.receiverName
                    traceNumber = inboundAchTransfer.traceNumber
                    transferId = inboundAchTransfer.transferId
                    additionalProperties = inboundAchTransfer.additionalProperties.toMutableMap()
                }

                /** Additional information sent from the originator. */
                fun addenda(addenda: Addenda?) = addenda(JsonField.ofNullable(addenda))

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

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

                /** The transfer amount in USD 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 description of the date of the transfer, usually in the format `YYMMDD`. */
                fun originatorCompanyDescriptiveDate(originatorCompanyDescriptiveDate: String?) =
                    originatorCompanyDescriptiveDate(
                        JsonField.ofNullable(originatorCompanyDescriptiveDate)
                    )

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

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

                /** Data set by the originator. */
                fun originatorCompanyDiscretionaryData(
                    originatorCompanyDiscretionaryData: String?
                ) =
                    originatorCompanyDiscretionaryData(
                        JsonField.ofNullable(originatorCompanyDiscretionaryData)
                    )

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

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

                /** An informational description of the transfer. */
                fun originatorCompanyEntryDescription(originatorCompanyEntryDescription: String) =
                    originatorCompanyEntryDescription(
                        JsonField.of(originatorCompanyEntryDescription)
                    )

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

                /**
                 * An identifier for the originating company. This is generally, but not always, a
                 * stable identifier across multiple transfers.
                 */
                fun originatorCompanyId(originatorCompanyId: String) =
                    originatorCompanyId(JsonField.of(originatorCompanyId))

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

                /** A name set by the originator to identify themselves. */
                fun originatorCompanyName(originatorCompanyName: String) =
                    originatorCompanyName(JsonField.of(originatorCompanyName))

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

                /** The originator's identifier for the transfer recipient. */
                fun receiverIdNumber(receiverIdNumber: String?) =
                    receiverIdNumber(JsonField.ofNullable(receiverIdNumber))

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

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

                /**
                 * The name of the transfer recipient. This value is informational and not verified
                 * by Increase.
                 */
                fun receiverName(receiverName: String?) =
                    receiverName(JsonField.ofNullable(receiverName))

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

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

                /**
                 * A 15 digit number recorded in the Nacha file and available to both the
                 * originating and receiving bank. Along with the amount, date, and originating
                 * routing number, this can be used to identify the ACH transfer at either bank. ACH
                 * trace numbers are not unique, but are
                 * [used to correlate returns](https://increase.com/documentation/ach-returns#ach-returns).
                 */
                fun traceNumber(traceNumber: String) = traceNumber(JsonField.of(traceNumber))

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

                /** The Inbound ACH Transfer's identifier. */
                fun transferId(transferId: String) = transferId(JsonField.of(transferId))

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

                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 [InboundAchTransfer].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .addenda()
                 * .amount()
                 * .originatorCompanyDescriptiveDate()
                 * .originatorCompanyDiscretionaryData()
                 * .originatorCompanyEntryDescription()
                 * .originatorCompanyId()
                 * .originatorCompanyName()
                 * .receiverIdNumber()
                 * .receiverName()
                 * .traceNumber()
                 * .transferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): InboundAchTransfer =
                    InboundAchTransfer(
                        checkRequired("addenda", addenda),
                        checkRequired("amount", amount),
                        checkRequired(
                            "originatorCompanyDescriptiveDate",
                            originatorCompanyDescriptiveDate,
                        ),
                        checkRequired(
                            "originatorCompanyDiscretionaryData",
                            originatorCompanyDiscretionaryData,
                        ),
                        checkRequired(
                            "originatorCompanyEntryDescription",
                            originatorCompanyEntryDescription,
                        ),
                        checkRequired("originatorCompanyId", originatorCompanyId),
                        checkRequired("originatorCompanyName", originatorCompanyName),
                        checkRequired("receiverIdNumber", receiverIdNumber),
                        checkRequired("receiverName", receiverName),
                        checkRequired("traceNumber", traceNumber),
                        checkRequired("transferId", transferId),
                        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(): InboundAchTransfer = apply {
                if (validated) {
                    return@apply
                }

                addenda().ifPresent { it.validate() }
                amount()
                originatorCompanyDescriptiveDate()
                originatorCompanyDiscretionaryData()
                originatorCompanyEntryDescription()
                originatorCompanyId()
                originatorCompanyName()
                receiverIdNumber()
                receiverName()
                traceNumber()
                transferId()
                validated = true
            }

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

            /**
             * Returns a score indicating how many valid values are contained in this object
             * recursively.
             *
             * Used for best match union deserialization.
             */
            @JvmSynthetic
            internal fun validity(): Int =
                (addenda.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (amount.asKnown().isPresent) 1 else 0) +
                    (if (originatorCompanyDescriptiveDate.asKnown().isPresent) 1 else 0) +
                    (if (originatorCompanyDiscretionaryData.asKnown().isPresent) 1 else 0) +
                    (if (originatorCompanyEntryDescription.asKnown().isPresent) 1 else 0) +
                    (if (originatorCompanyId.asKnown().isPresent) 1 else 0) +
                    (if (originatorCompanyName.asKnown().isPresent) 1 else 0) +
                    (if (receiverIdNumber.asKnown().isPresent) 1 else 0) +
                    (if (receiverName.asKnown().isPresent) 1 else 0) +
                    (if (traceNumber.asKnown().isPresent) 1 else 0) +
                    (if (transferId.asKnown().isPresent) 1 else 0)

            /** Additional information sent from the originator. */
            class Addenda
            @JsonCreator(mode = JsonCreator.Mode.DISABLED)
            private constructor(
                private val category: JsonField<Category>,
                private val freeform: JsonField<Freeform>,
                private val additionalProperties: MutableMap<String, JsonValue>,
            ) {

                @JsonCreator
                private constructor(
                    @JsonProperty("category")
                    @ExcludeMissing
                    category: JsonField<Category> = JsonMissing.of(),
                    @JsonProperty("freeform")
                    @ExcludeMissing
                    freeform: JsonField<Freeform> = JsonMissing.of(),
                ) : this(category, freeform, mutableMapOf())

                /**
                 * The type of addendum.
                 *
                 * @throws IncreaseInvalidDataException if 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")

                /**
                 * Unstructured `payment_related_information` passed through by the originator.
                 *
                 * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                 *   (e.g. if the server responded with an unexpected value).
                 */
                fun freeform(): Optional<Freeform> = freeform.getOptional("freeform")

                /**
                 * 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 [freeform].
                 *
                 * Unlike [freeform], this method doesn't throw if the JSON field has an unexpected
                 * type.
                 */
                @JsonProperty("freeform")
                @ExcludeMissing
                fun _freeform(): JsonField<Freeform> = freeform

                @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 [Addenda].
                     *
                     * The following fields are required:
                     * ```java
                     * .category()
                     * .freeform()
                     * ```
                     */
                    @JvmStatic fun builder() = Builder()
                }

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

                    private var category: JsonField<Category>? = null
                    private var freeform: JsonField<Freeform>? = null
                    private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                    @JvmSynthetic
                    internal fun from(addenda: Addenda) = apply {
                        category = addenda.category
                        freeform = addenda.freeform
                        additionalProperties = addenda.additionalProperties.toMutableMap()
                    }

                    /** The type of addendum. */
                    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 }

                    /**
                     * Unstructured `payment_related_information` passed through by the originator.
                     */
                    fun freeform(freeform: Freeform?) = freeform(JsonField.ofNullable(freeform))

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

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

                    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 [Addenda].
                     *
                     * Further updates to this [Builder] will not mutate the returned instance.
                     *
                     * The following fields are required:
                     * ```java
                     * .category()
                     * .freeform()
                     * ```
                     *
                     * @throws IllegalStateException if any required field is unset.
                     */
                    fun build(): Addenda =
                        Addenda(
                            checkRequired("category", category),
                            checkRequired("freeform", freeform),
                            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(): Addenda = apply {
                    if (validated) {
                        return@apply
                    }

                    category().validate()
                    freeform().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) +
                        (freeform.asKnown().getOrNull()?.validity() ?: 0)

                /** The type of addendum. */
                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 {

                        /** Unstructured addendum. */
                        @JvmField val FREEFORM = of("freeform")

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

                    /** An enum containing [Category]'s known values. */
                    enum class Known {
                        /** Unstructured addendum. */
                        FREEFORM
                    }

                    /**
                     * 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 {
                        /** Unstructured addendum. */
                        FREEFORM,
                        /**
                         * 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) {
                            FREEFORM -> Value.FREEFORM
                            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) {
                            FREEFORM -> Known.FREEFORM
                            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()
                }

                /** Unstructured `payment_related_information` passed through by the originator. */
                class Freeform
                @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                private constructor(
                    private val entries: JsonField<List<Entry>>,
                    private val additionalProperties: MutableMap<String, JsonValue>,
                ) {

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

                    /**
                     * Each entry represents an addendum received from the originator.
                     *
                     * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
                     *   or is unexpectedly missing or null (e.g. if the server responded with an
                     *   unexpected value).
                     */
                    fun entries(): List<Entry> = entries.getRequired("entries")

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

                    @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 [Freeform].
                         *
                         * The following fields are required:
                         * ```java
                         * .entries()
                         * ```
                         */
                        @JvmStatic fun builder() = Builder()
                    }

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

                        private var entries: JsonField<MutableList<Entry>>? = null
                        private var additionalProperties: MutableMap<String, JsonValue> =
                            mutableMapOf()

                        @JvmSynthetic
                        internal fun from(freeform: Freeform) = apply {
                            entries = freeform.entries.map { it.toMutableList() }
                            additionalProperties = freeform.additionalProperties.toMutableMap()
                        }

                        /** Each entry represents an addendum received from the originator. */
                        fun entries(entries: List<Entry>) = entries(JsonField.of(entries))

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

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

                        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 [Freeform].
                         *
                         * Further updates to this [Builder] will not mutate the returned instance.
                         *
                         * The following fields are required:
                         * ```java
                         * .entries()
                         * ```
                         *
                         * @throws IllegalStateException if any required field is unset.
                         */
                        fun build(): Freeform =
                            Freeform(
                                checkRequired("entries", entries).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(): Freeform = apply {
                        if (validated) {
                            return@apply
                        }

                        entries().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 =
                        (entries.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)

                    class Entry
                    @JsonCreator(mode = JsonCreator.Mode.DISABLED)
                    private constructor(
                        private val paymentRelatedInformation: JsonField<String>,
                        private val additionalProperties: MutableMap<String, JsonValue>,
                    ) {

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

                        /**
                         * The payment related information passed in the addendum.
                         *
                         * @throws IncreaseInvalidDataException if the JSON field has an unexpected
                         *   type or is unexpectedly missing or null (e.g. if the server responded
                         *   with an unexpected value).
                         */
                        fun paymentRelatedInformation(): String =
                            paymentRelatedInformation.getRequired("payment_related_information")

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

                        @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 [Entry].
                             *
                             * The following fields are required:
                             * ```java
                             * .paymentRelatedInformation()
                             * ```
                             */
                            @JvmStatic fun builder() = Builder()
                        }

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

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

                            @JvmSynthetic
                            internal fun from(entry: Entry) = apply {
                                paymentRelatedInformation = entry.paymentRelatedInformation
                                additionalProperties = entry.additionalProperties.toMutableMap()
                            }

                            /** The payment related information passed in the addendum. */
                            fun paymentRelatedInformation(paymentRelatedInformation: String) =
                                paymentRelatedInformation(JsonField.of(paymentRelatedInformation))

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

                            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 [Entry].
                             *
                             * Further updates to this [Builder] will not mutate the returned
                             * instance.
                             *
                             * The following fields are required:
                             * ```java
                             * .paymentRelatedInformation()
                             * ```
                             *
                             * @throws IllegalStateException if any required field is unset.
                             */
                            fun build(): Entry =
                                Entry(
                                    checkRequired(
                                        "paymentRelatedInformation",
                                        paymentRelatedInformation,
                                    ),
                                    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(): Entry = apply {
                            if (validated) {
                                return@apply
                            }

                            paymentRelatedInformation()
                            validated = true
                        }

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

                        /**
                         * Returns 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 (paymentRelatedInformation.asKnown().isPresent) 1 else 0)

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

                            return other is Entry &&
                                paymentRelatedInformation == other.paymentRelatedInformation &&
                                additionalProperties == other.additionalProperties
                        }

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

                        override fun hashCode(): Int = hashCode

                        override fun toString() =
                            "Entry{paymentRelatedInformation=$paymentRelatedInformation, additionalProperties=$additionalProperties}"
                    }

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

                        return other is Freeform &&
                            entries == other.entries &&
                            additionalProperties == other.additionalProperties
                    }

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

                    override fun hashCode(): Int = hashCode

                    override fun toString() =
                        "Freeform{entries=$entries, additionalProperties=$additionalProperties}"
                }

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

                    return other is Addenda &&
                        category == other.category &&
                        freeform == other.freeform &&
                        additionalProperties == other.additionalProperties
                }

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

                override fun hashCode(): Int = hashCode

                override fun toString() =
                    "Addenda{category=$category, freeform=$freeform, additionalProperties=$additionalProperties}"
            }

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

                return other is InboundAchTransfer &&
                    addenda == other.addenda &&
                    amount == other.amount &&
                    originatorCompanyDescriptiveDate == other.originatorCompanyDescriptiveDate &&
                    originatorCompanyDiscretionaryData ==
                        other.originatorCompanyDiscretionaryData &&
                    originatorCompanyEntryDescription == other.originatorCompanyEntryDescription &&
                    originatorCompanyId == other.originatorCompanyId &&
                    originatorCompanyName == other.originatorCompanyName &&
                    receiverIdNumber == other.receiverIdNumber &&
                    receiverName == other.receiverName &&
                    traceNumber == other.traceNumber &&
                    transferId == other.transferId &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    addenda,
                    amount,
                    originatorCompanyDescriptiveDate,
                    originatorCompanyDiscretionaryData,
                    originatorCompanyEntryDescription,
                    originatorCompanyId,
                    originatorCompanyName,
                    receiverIdNumber,
                    receiverName,
                    traceNumber,
                    transferId,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "InboundAchTransfer{addenda=$addenda, amount=$amount, originatorCompanyDescriptiveDate=$originatorCompanyDescriptiveDate, originatorCompanyDiscretionaryData=$originatorCompanyDiscretionaryData, originatorCompanyEntryDescription=$originatorCompanyEntryDescription, originatorCompanyId=$originatorCompanyId, originatorCompanyName=$originatorCompanyName, receiverIdNumber=$receiverIdNumber, receiverName=$receiverName, traceNumber=$traceNumber, transferId=$transferId, additionalProperties=$additionalProperties}"
        }

        /**
         * An Inbound ACH Transfer Return Intention object. This field will be present in the JSON
         * response if and only if `category` is equal to `inbound_ach_transfer_return_intention`.
         * An Inbound ACH Transfer Return Intention is created when an ACH transfer is initiated at
         * another bank and returned by Increase.
         */
        class InboundAchTransferReturnIntention
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val inboundAchTransferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

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

            /**
             * The ID of the Inbound ACH Transfer that is being returned.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun inboundAchTransferId(): String =
                inboundAchTransferId.getRequired("inbound_ach_transfer_id")

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

            @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
                 * [InboundAchTransferReturnIntention].
                 *
                 * The following fields are required:
                 * ```java
                 * .inboundAchTransferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

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

                @JvmSynthetic
                internal fun from(
                    inboundAchTransferReturnIntention: InboundAchTransferReturnIntention
                ) = apply {
                    inboundAchTransferId = inboundAchTransferReturnIntention.inboundAchTransferId
                    additionalProperties =
                        inboundAchTransferReturnIntention.additionalProperties.toMutableMap()
                }

                /** The ID of the Inbound ACH Transfer that is being returned. */
                fun inboundAchTransferId(inboundAchTransferId: String) =
                    inboundAchTransferId(JsonField.of(inboundAchTransferId))

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

                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 [InboundAchTransferReturnIntention].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .inboundAchTransferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): InboundAchTransferReturnIntention =
                    InboundAchTransferReturnIntention(
                        checkRequired("inboundAchTransferId", inboundAchTransferId),
                        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(): InboundAchTransferReturnIntention = apply {
                if (validated) {
                    return@apply
                }

                inboundAchTransferId()
                validated = true
            }

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

            /**
             * Returns 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 (inboundAchTransferId.asKnown().isPresent) 1 else 0)

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

                return other is InboundAchTransferReturnIntention &&
                    inboundAchTransferId == other.inboundAchTransferId &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "InboundAchTransferReturnIntention{inboundAchTransferId=$inboundAchTransferId, additionalProperties=$additionalProperties}"
        }

        /**
         * An Inbound Check Adjustment object. This field will be present in the JSON response if
         * and only if `category` is equal to `inbound_check_adjustment`. An Inbound Check
         * Adjustment is created when Increase receives an adjustment for a check or return
         * deposited through Check21.
         */
        class InboundCheckAdjustment
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val adjustedTransactionId: JsonField<String>,
            private val amount: JsonField<Long>,
            private val reason: JsonField<Reason>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("adjusted_transaction_id")
                @ExcludeMissing
                adjustedTransactionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("reason") @ExcludeMissing reason: JsonField<Reason> = JsonMissing.of(),
            ) : this(adjustedTransactionId, amount, reason, mutableMapOf())

            /**
             * The ID of the transaction that was adjusted.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun adjustedTransactionId(): String =
                adjustedTransactionId.getRequired("adjusted_transaction_id")

            /**
             * The amount of the check adjustment.
             *
             * @throws IncreaseInvalidDataException if 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 reason for the adjustment.
             *
             * @throws IncreaseInvalidDataException if 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")

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

            /**
             * 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 [reason].
             *
             * Unlike [reason], this method doesn't throw if the JSON field has an unexpected type.
             */
            @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField<Reason> = reason

            @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
                 * [InboundCheckAdjustment].
                 *
                 * The following fields are required:
                 * ```java
                 * .adjustedTransactionId()
                 * .amount()
                 * .reason()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var adjustedTransactionId: JsonField<String>? = null
                private var amount: JsonField<Long>? = null
                private var reason: JsonField<Reason>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(inboundCheckAdjustment: InboundCheckAdjustment) = apply {
                    adjustedTransactionId = inboundCheckAdjustment.adjustedTransactionId
                    amount = inboundCheckAdjustment.amount
                    reason = inboundCheckAdjustment.reason
                    additionalProperties =
                        inboundCheckAdjustment.additionalProperties.toMutableMap()
                }

                /** The ID of the transaction that was adjusted. */
                fun adjustedTransactionId(adjustedTransactionId: String) =
                    adjustedTransactionId(JsonField.of(adjustedTransactionId))

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

                /** The amount of the check adjustment. */
                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 reason for the adjustment. */
                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 }

                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 [InboundCheckAdjustment].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .adjustedTransactionId()
                 * .amount()
                 * .reason()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): InboundCheckAdjustment =
                    InboundCheckAdjustment(
                        checkRequired("adjustedTransactionId", adjustedTransactionId),
                        checkRequired("amount", amount),
                        checkRequired("reason", reason),
                        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(): InboundCheckAdjustment = apply {
                if (validated) {
                    return@apply
                }

                adjustedTransactionId()
                amount()
                reason().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 (adjustedTransactionId.asKnown().isPresent) 1 else 0) +
                    (if (amount.asKnown().isPresent) 1 else 0) +
                    (reason.asKnown().getOrNull()?.validity() ?: 0)

            /** The reason for the adjustment. */
            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 return was initiated too late and the receiving institution has responded
                     * with a Late Return Claim.
                     */
                    @JvmField val LATE_RETURN = of("late_return")

                    /**
                     * The check was deposited to the wrong payee and the depositing institution has
                     * reimbursed the funds with a Wrong Payee Credit.
                     */
                    @JvmField val WRONG_PAYEE_CREDIT = of("wrong_payee_credit")

                    /**
                     * The check was deposited with a different amount than what was written on the
                     * check.
                     */
                    @JvmField val ADJUSTED_AMOUNT = of("adjusted_amount")

                    /**
                     * The recipient was not able to process the check. This usually happens for
                     * e.g., low quality images.
                     */
                    @JvmField val NON_CONFORMING_ITEM = of("non_conforming_item")

                    /**
                     * The check has already been deposited elsewhere and so this is a duplicate.
                     */
                    @JvmField val PAID = of("paid")

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

                /** An enum containing [Reason]'s known values. */
                enum class Known {
                    /**
                     * The return was initiated too late and the receiving institution has responded
                     * with a Late Return Claim.
                     */
                    LATE_RETURN,
                    /**
                     * The check was deposited to the wrong payee and the depositing institution has
                     * reimbursed the funds with a Wrong Payee Credit.
                     */
                    WRONG_PAYEE_CREDIT,
                    /**
                     * The check was deposited with a different amount than what was written on the
                     * check.
                     */
                    ADJUSTED_AMOUNT,
                    /**
                     * The recipient was not able to process the check. This usually happens for
                     * e.g., low quality images.
                     */
                    NON_CONFORMING_ITEM,
                    /**
                     * The check has already been deposited elsewhere and so this is a duplicate.
                     */
                    PAID,
                }

                /**
                 * 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 return was initiated too late and the receiving institution has responded
                     * with a Late Return Claim.
                     */
                    LATE_RETURN,
                    /**
                     * The check was deposited to the wrong payee and the depositing institution has
                     * reimbursed the funds with a Wrong Payee Credit.
                     */
                    WRONG_PAYEE_CREDIT,
                    /**
                     * The check was deposited with a different amount than what was written on the
                     * check.
                     */
                    ADJUSTED_AMOUNT,
                    /**
                     * The recipient was not able to process the check. This usually happens for
                     * e.g., low quality images.
                     */
                    NON_CONFORMING_ITEM,
                    /**
                     * The check has already been deposited elsewhere and so this is a duplicate.
                     */
                    PAID,
                    /**
                     * 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) {
                        LATE_RETURN -> Value.LATE_RETURN
                        WRONG_PAYEE_CREDIT -> Value.WRONG_PAYEE_CREDIT
                        ADJUSTED_AMOUNT -> Value.ADJUSTED_AMOUNT
                        NON_CONFORMING_ITEM -> Value.NON_CONFORMING_ITEM
                        PAID -> Value.PAID
                        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) {
                        LATE_RETURN -> Known.LATE_RETURN
                        WRONG_PAYEE_CREDIT -> Known.WRONG_PAYEE_CREDIT
                        ADJUSTED_AMOUNT -> Known.ADJUSTED_AMOUNT
                        NON_CONFORMING_ITEM -> Known.NON_CONFORMING_ITEM
                        PAID -> Known.PAID
                        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()
            }

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

                return other is InboundCheckAdjustment &&
                    adjustedTransactionId == other.adjustedTransactionId &&
                    amount == other.amount &&
                    reason == other.reason &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "InboundCheckAdjustment{adjustedTransactionId=$adjustedTransactionId, amount=$amount, reason=$reason, additionalProperties=$additionalProperties}"
        }

        /**
         * An Inbound Check Deposit Return Intention object. This field will be present in the JSON
         * response if and only if `category` is equal to `inbound_check_deposit_return_intention`.
         * An Inbound Check Deposit Return Intention is created when Increase receives an Inbound
         * Check and the User requests that it be returned.
         */
        class InboundCheckDepositReturnIntention
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val inboundCheckDepositId: JsonField<String>,
            private val transferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("inbound_check_deposit_id")
                @ExcludeMissing
                inboundCheckDepositId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transfer_id")
                @ExcludeMissing
                transferId: JsonField<String> = JsonMissing.of(),
            ) : this(inboundCheckDepositId, transferId, mutableMapOf())

            /**
             * The ID of the Inbound Check Deposit that is being returned.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun inboundCheckDepositId(): String =
                inboundCheckDepositId.getRequired("inbound_check_deposit_id")

            /**
             * The identifier of the Check Transfer object that was deposited.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun transferId(): Optional<String> = transferId.getOptional("transfer_id")

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

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

            @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
                 * [InboundCheckDepositReturnIntention].
                 *
                 * The following fields are required:
                 * ```java
                 * .inboundCheckDepositId()
                 * .transferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

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

                @JvmSynthetic
                internal fun from(
                    inboundCheckDepositReturnIntention: InboundCheckDepositReturnIntention
                ) = apply {
                    inboundCheckDepositId = inboundCheckDepositReturnIntention.inboundCheckDepositId
                    transferId = inboundCheckDepositReturnIntention.transferId
                    additionalProperties =
                        inboundCheckDepositReturnIntention.additionalProperties.toMutableMap()
                }

                /** The ID of the Inbound Check Deposit that is being returned. */
                fun inboundCheckDepositId(inboundCheckDepositId: String) =
                    inboundCheckDepositId(JsonField.of(inboundCheckDepositId))

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

                /** The identifier of the Check Transfer object that was deposited. */
                fun transferId(transferId: String?) = transferId(JsonField.ofNullable(transferId))

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

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

                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 [InboundCheckDepositReturnIntention].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .inboundCheckDepositId()
                 * .transferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): InboundCheckDepositReturnIntention =
                    InboundCheckDepositReturnIntention(
                        checkRequired("inboundCheckDepositId", inboundCheckDepositId),
                        checkRequired("transferId", transferId),
                        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(): InboundCheckDepositReturnIntention = apply {
                if (validated) {
                    return@apply
                }

                inboundCheckDepositId()
                transferId()
                validated = true
            }

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

            /**
             * Returns 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 (inboundCheckDepositId.asKnown().isPresent) 1 else 0) +
                    (if (transferId.asKnown().isPresent) 1 else 0)

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

                return other is InboundCheckDepositReturnIntention &&
                    inboundCheckDepositId == other.inboundCheckDepositId &&
                    transferId == other.transferId &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "InboundCheckDepositReturnIntention{inboundCheckDepositId=$inboundCheckDepositId, transferId=$transferId, additionalProperties=$additionalProperties}"
        }

        /**
         * An Inbound FedNow Transfer Confirmation object. This field will be present in the JSON
         * response if and only if `category` is equal to `inbound_fednow_transfer_confirmation`. An
         * Inbound FedNow Transfer Confirmation is created when a FedNow transfer is initiated at
         * another bank and received by Increase.
         */
        class InboundFednowTransferConfirmation
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val transferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

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

            /**
             * The identifier of the FedNow Transfer that led to 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 transferId(): String = transferId.getRequired("transfer_id")

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

            @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
                 * [InboundFednowTransferConfirmation].
                 *
                 * The following fields are required:
                 * ```java
                 * .transferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

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

                @JvmSynthetic
                internal fun from(
                    inboundFednowTransferConfirmation: InboundFednowTransferConfirmation
                ) = apply {
                    transferId = inboundFednowTransferConfirmation.transferId
                    additionalProperties =
                        inboundFednowTransferConfirmation.additionalProperties.toMutableMap()
                }

                /** The identifier of the FedNow Transfer that led to this Transaction. */
                fun transferId(transferId: String) = transferId(JsonField.of(transferId))

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

                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 [InboundFednowTransferConfirmation].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .transferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): InboundFednowTransferConfirmation =
                    InboundFednowTransferConfirmation(
                        checkRequired("transferId", transferId),
                        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(): InboundFednowTransferConfirmation = apply {
                if (validated) {
                    return@apply
                }

                transferId()
                validated = true
            }

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

            /**
             * Returns 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 (transferId.asKnown().isPresent) 1 else 0)

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

                return other is InboundFednowTransferConfirmation &&
                    transferId == other.transferId &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "InboundFednowTransferConfirmation{transferId=$transferId, additionalProperties=$additionalProperties}"
        }

        /**
         * An Inbound Real-Time Payments Transfer Confirmation object. This field will be present in
         * the JSON response if and only if `category` is equal to
         * `inbound_real_time_payments_transfer_confirmation`. An Inbound Real-Time Payments
         * Transfer Confirmation is created when a Real-Time Payments transfer is initiated at
         * another bank and received by Increase.
         */
        class InboundRealTimePaymentsTransferConfirmation
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val amount: JsonField<Long>,
            private val creditorName: JsonField<String>,
            private val currency: JsonField<Currency>,
            private val debtorAccountNumber: JsonField<String>,
            private val debtorName: JsonField<String>,
            private val debtorRoutingNumber: JsonField<String>,
            private val transactionIdentification: JsonField<String>,
            private val transferId: JsonField<String>,
            private val unstructuredRemittanceInformation: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("creditor_name")
                @ExcludeMissing
                creditorName: JsonField<String> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("debtor_account_number")
                @ExcludeMissing
                debtorAccountNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("debtor_name")
                @ExcludeMissing
                debtorName: JsonField<String> = JsonMissing.of(),
                @JsonProperty("debtor_routing_number")
                @ExcludeMissing
                debtorRoutingNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transaction_identification")
                @ExcludeMissing
                transactionIdentification: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transfer_id")
                @ExcludeMissing
                transferId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("unstructured_remittance_information")
                @ExcludeMissing
                unstructuredRemittanceInformation: JsonField<String> = JsonMissing.of(),
            ) : this(
                amount,
                creditorName,
                currency,
                debtorAccountNumber,
                debtorName,
                debtorRoutingNumber,
                transactionIdentification,
                transferId,
                unstructuredRemittanceInformation,
                mutableMapOf(),
            )

            /**
             * The amount in the minor unit of the transfer'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 name the sender of the transfer specified as the recipient of the transfer.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun creditorName(): String = creditorName.getRequired("creditor_name")

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code of the transfer's
             * currency. This will always be "USD" for a Real-Time Payments transfer.
             *
             * @throws IncreaseInvalidDataException if 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 account number of the account that sent the transfer.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun debtorAccountNumber(): String =
                debtorAccountNumber.getRequired("debtor_account_number")

            /**
             * The name provided by the sender of the transfer.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun debtorName(): String = debtorName.getRequired("debtor_name")

            /**
             * The routing number of the account that sent the transfer.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun debtorRoutingNumber(): String =
                debtorRoutingNumber.getRequired("debtor_routing_number")

            /**
             * The Real-Time Payments network identification of the transfer.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun transactionIdentification(): String =
                transactionIdentification.getRequired("transaction_identification")

            /**
             * The identifier of the Real-Time Payments Transfer that led to 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 transferId(): String = transferId.getRequired("transfer_id")

            /**
             * Additional information included with the transfer.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun unstructuredRemittanceInformation(): Optional<String> =
                unstructuredRemittanceInformation.getOptional("unstructured_remittance_information")

            /**
             * 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 [creditorName].
             *
             * Unlike [creditorName], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("creditor_name")
            @ExcludeMissing
            fun _creditorName(): JsonField<String> = creditorName

            /**
             * 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 [debtorAccountNumber].
             *
             * Unlike [debtorAccountNumber], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("debtor_account_number")
            @ExcludeMissing
            fun _debtorAccountNumber(): JsonField<String> = debtorAccountNumber

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

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

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

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

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

            @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
                 * [InboundRealTimePaymentsTransferConfirmation].
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .creditorName()
                 * .currency()
                 * .debtorAccountNumber()
                 * .debtorName()
                 * .debtorRoutingNumber()
                 * .transactionIdentification()
                 * .transferId()
                 * .unstructuredRemittanceInformation()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var amount: JsonField<Long>? = null
                private var creditorName: JsonField<String>? = null
                private var currency: JsonField<Currency>? = null
                private var debtorAccountNumber: JsonField<String>? = null
                private var debtorName: JsonField<String>? = null
                private var debtorRoutingNumber: JsonField<String>? = null
                private var transactionIdentification: JsonField<String>? = null
                private var transferId: JsonField<String>? = null
                private var unstructuredRemittanceInformation: JsonField<String>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(
                    inboundRealTimePaymentsTransferConfirmation:
                        InboundRealTimePaymentsTransferConfirmation
                ) = apply {
                    amount = inboundRealTimePaymentsTransferConfirmation.amount
                    creditorName = inboundRealTimePaymentsTransferConfirmation.creditorName
                    currency = inboundRealTimePaymentsTransferConfirmation.currency
                    debtorAccountNumber =
                        inboundRealTimePaymentsTransferConfirmation.debtorAccountNumber
                    debtorName = inboundRealTimePaymentsTransferConfirmation.debtorName
                    debtorRoutingNumber =
                        inboundRealTimePaymentsTransferConfirmation.debtorRoutingNumber
                    transactionIdentification =
                        inboundRealTimePaymentsTransferConfirmation.transactionIdentification
                    transferId = inboundRealTimePaymentsTransferConfirmation.transferId
                    unstructuredRemittanceInformation =
                        inboundRealTimePaymentsTransferConfirmation
                            .unstructuredRemittanceInformation
                    additionalProperties =
                        inboundRealTimePaymentsTransferConfirmation.additionalProperties
                            .toMutableMap()
                }

                /**
                 * The amount in the minor unit of the transfer'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 name the sender of the transfer specified as the recipient of the transfer.
                 */
                fun creditorName(creditorName: String) = creditorName(JsonField.of(creditorName))

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

                /**
                 * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code of the transfer's
                 * currency. This will always be "USD" for a Real-Time Payments transfer.
                 */
                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 account number of the account that sent the transfer. */
                fun debtorAccountNumber(debtorAccountNumber: String) =
                    debtorAccountNumber(JsonField.of(debtorAccountNumber))

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

                /** The name provided by the sender of the transfer. */
                fun debtorName(debtorName: String) = debtorName(JsonField.of(debtorName))

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

                /** The routing number of the account that sent the transfer. */
                fun debtorRoutingNumber(debtorRoutingNumber: String) =
                    debtorRoutingNumber(JsonField.of(debtorRoutingNumber))

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

                /** The Real-Time Payments network identification of the transfer. */
                fun transactionIdentification(transactionIdentification: String) =
                    transactionIdentification(JsonField.of(transactionIdentification))

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

                /**
                 * The identifier of the Real-Time Payments Transfer that led to this Transaction.
                 */
                fun transferId(transferId: String) = transferId(JsonField.of(transferId))

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

                /** Additional information included with the transfer. */
                fun unstructuredRemittanceInformation(unstructuredRemittanceInformation: String?) =
                    unstructuredRemittanceInformation(
                        JsonField.ofNullable(unstructuredRemittanceInformation)
                    )

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

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

                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 [InboundRealTimePaymentsTransferConfirmation].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .creditorName()
                 * .currency()
                 * .debtorAccountNumber()
                 * .debtorName()
                 * .debtorRoutingNumber()
                 * .transactionIdentification()
                 * .transferId()
                 * .unstructuredRemittanceInformation()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): InboundRealTimePaymentsTransferConfirmation =
                    InboundRealTimePaymentsTransferConfirmation(
                        checkRequired("amount", amount),
                        checkRequired("creditorName", creditorName),
                        checkRequired("currency", currency),
                        checkRequired("debtorAccountNumber", debtorAccountNumber),
                        checkRequired("debtorName", debtorName),
                        checkRequired("debtorRoutingNumber", debtorRoutingNumber),
                        checkRequired("transactionIdentification", transactionIdentification),
                        checkRequired("transferId", transferId),
                        checkRequired(
                            "unstructuredRemittanceInformation",
                            unstructuredRemittanceInformation,
                        ),
                        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(): InboundRealTimePaymentsTransferConfirmation = apply {
                if (validated) {
                    return@apply
                }

                amount()
                creditorName()
                currency().validate()
                debtorAccountNumber()
                debtorName()
                debtorRoutingNumber()
                transactionIdentification()
                transferId()
                unstructuredRemittanceInformation()
                validated = true
            }

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

            /**
             * Returns 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 (creditorName.asKnown().isPresent) 1 else 0) +
                    (currency.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (debtorAccountNumber.asKnown().isPresent) 1 else 0) +
                    (if (debtorName.asKnown().isPresent) 1 else 0) +
                    (if (debtorRoutingNumber.asKnown().isPresent) 1 else 0) +
                    (if (transactionIdentification.asKnown().isPresent) 1 else 0) +
                    (if (transferId.asKnown().isPresent) 1 else 0) +
                    (if (unstructuredRemittanceInformation.asKnown().isPresent) 1 else 0)

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code of the transfer's
             * currency. This will always be "USD" for a Real-Time Payments transfer.
             */
            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 InboundRealTimePaymentsTransferConfirmation &&
                    amount == other.amount &&
                    creditorName == other.creditorName &&
                    currency == other.currency &&
                    debtorAccountNumber == other.debtorAccountNumber &&
                    debtorName == other.debtorName &&
                    debtorRoutingNumber == other.debtorRoutingNumber &&
                    transactionIdentification == other.transactionIdentification &&
                    transferId == other.transferId &&
                    unstructuredRemittanceInformation == other.unstructuredRemittanceInformation &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    amount,
                    creditorName,
                    currency,
                    debtorAccountNumber,
                    debtorName,
                    debtorRoutingNumber,
                    transactionIdentification,
                    transferId,
                    unstructuredRemittanceInformation,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "InboundRealTimePaymentsTransferConfirmation{amount=$amount, creditorName=$creditorName, currency=$currency, debtorAccountNumber=$debtorAccountNumber, debtorName=$debtorName, debtorRoutingNumber=$debtorRoutingNumber, transactionIdentification=$transactionIdentification, transferId=$transferId, unstructuredRemittanceInformation=$unstructuredRemittanceInformation, additionalProperties=$additionalProperties}"
        }

        /**
         * An Inbound Wire Reversal object. This field will be present in the JSON response if and
         * only if `category` is equal to `inbound_wire_reversal`. An Inbound Wire Reversal
         * represents a reversal of a wire transfer that was initiated via Increase. The other bank
         * is sending the money back. This most often happens when the original destination account
         * details were incorrect.
         */
        class InboundWireReversal
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val amount: JsonField<Long>,
            private val createdAt: JsonField<OffsetDateTime>,
            private val debtorRoutingNumber: JsonField<String>,
            private val description: JsonField<String>,
            private val inputCycleDate: JsonField<LocalDate>,
            private val inputMessageAccountabilityData: JsonField<String>,
            private val inputSequenceNumber: JsonField<String>,
            private val inputSource: JsonField<String>,
            private val instructionIdentification: JsonField<String>,
            private val returnReasonAdditionalInformation: JsonField<String>,
            private val returnReasonCode: JsonField<String>,
            private val returnReasonCodeDescription: JsonField<String>,
            private val transactionId: JsonField<String>,
            private val wireTransferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("created_at")
                @ExcludeMissing
                createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
                @JsonProperty("debtor_routing_number")
                @ExcludeMissing
                debtorRoutingNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("description")
                @ExcludeMissing
                description: JsonField<String> = JsonMissing.of(),
                @JsonProperty("input_cycle_date")
                @ExcludeMissing
                inputCycleDate: JsonField<LocalDate> = JsonMissing.of(),
                @JsonProperty("input_message_accountability_data")
                @ExcludeMissing
                inputMessageAccountabilityData: JsonField<String> = JsonMissing.of(),
                @JsonProperty("input_sequence_number")
                @ExcludeMissing
                inputSequenceNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("input_source")
                @ExcludeMissing
                inputSource: JsonField<String> = JsonMissing.of(),
                @JsonProperty("instruction_identification")
                @ExcludeMissing
                instructionIdentification: JsonField<String> = JsonMissing.of(),
                @JsonProperty("return_reason_additional_information")
                @ExcludeMissing
                returnReasonAdditionalInformation: JsonField<String> = JsonMissing.of(),
                @JsonProperty("return_reason_code")
                @ExcludeMissing
                returnReasonCode: JsonField<String> = JsonMissing.of(),
                @JsonProperty("return_reason_code_description")
                @ExcludeMissing
                returnReasonCodeDescription: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transaction_id")
                @ExcludeMissing
                transactionId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("wire_transfer_id")
                @ExcludeMissing
                wireTransferId: JsonField<String> = JsonMissing.of(),
            ) : this(
                amount,
                createdAt,
                debtorRoutingNumber,
                description,
                inputCycleDate,
                inputMessageAccountabilityData,
                inputSequenceNumber,
                inputSource,
                instructionIdentification,
                returnReasonAdditionalInformation,
                returnReasonCode,
                returnReasonCodeDescription,
                transactionId,
                wireTransferId,
                mutableMapOf(),
            )

            /**
             * The amount that was reversed in USD 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 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the
             * reversal 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 debtor's routing number.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun debtorRoutingNumber(): Optional<String> =
                debtorRoutingNumber.getOptional("debtor_routing_number")

            /**
             * The description on the reversal message from Fedwire, set by the reversing bank.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun description(): String = description.getRequired("description")

            /**
             * The Fedwire cycle date for the wire reversal. The "Fedwire day" begins at 9:00 PM
             * Eastern Time on the evening before the `cycle date`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun inputCycleDate(): LocalDate = inputCycleDate.getRequired("input_cycle_date")

            /**
             * The Fedwire transaction 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 inputMessageAccountabilityData(): String =
                inputMessageAccountabilityData.getRequired("input_message_accountability_data")

            /**
             * The Fedwire sequence 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 inputSequenceNumber(): String =
                inputSequenceNumber.getRequired("input_sequence_number")

            /**
             * The Fedwire input source 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 inputSource(): String = inputSource.getRequired("input_source")

            /**
             * The sending bank's identifier for the reversal.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun instructionIdentification(): Optional<String> =
                instructionIdentification.getOptional("instruction_identification")

            /**
             * Additional information about the reason for the reversal.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun returnReasonAdditionalInformation(): Optional<String> =
                returnReasonAdditionalInformation.getOptional(
                    "return_reason_additional_information"
                )

            /**
             * A code provided by the sending bank giving a reason for the reversal. The common
             * return reason codes are
             * [documented here](/documentation/wire-reversals#reversal-reason-codes).
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun returnReasonCode(): Optional<String> =
                returnReasonCode.getOptional("return_reason_code")

            /**
             * An Increase-generated description of the `return_reason_code`.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun returnReasonCodeDescription(): Optional<String> =
                returnReasonCodeDescription.getOptional("return_reason_code_description")

            /**
             * The ID for the Transaction associated with the transfer 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 transactionId(): String = transactionId.getRequired("transaction_id")

            /**
             * The ID for the Wire Transfer that is being reversed.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun wireTransferId(): String = wireTransferId.getRequired("wire_transfer_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 [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 [debtorRoutingNumber].
             *
             * Unlike [debtorRoutingNumber], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("debtor_routing_number")
            @ExcludeMissing
            fun _debtorRoutingNumber(): JsonField<String> = debtorRoutingNumber

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

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

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

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

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

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

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

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

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

            /**
             * 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 [wireTransferId].
             *
             * Unlike [wireTransferId], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("wire_transfer_id")
            @ExcludeMissing
            fun _wireTransferId(): JsonField<String> = wireTransferId

            @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 [InboundWireReversal].
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .createdAt()
                 * .debtorRoutingNumber()
                 * .description()
                 * .inputCycleDate()
                 * .inputMessageAccountabilityData()
                 * .inputSequenceNumber()
                 * .inputSource()
                 * .instructionIdentification()
                 * .returnReasonAdditionalInformation()
                 * .returnReasonCode()
                 * .returnReasonCodeDescription()
                 * .transactionId()
                 * .wireTransferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var amount: JsonField<Long>? = null
                private var createdAt: JsonField<OffsetDateTime>? = null
                private var debtorRoutingNumber: JsonField<String>? = null
                private var description: JsonField<String>? = null
                private var inputCycleDate: JsonField<LocalDate>? = null
                private var inputMessageAccountabilityData: JsonField<String>? = null
                private var inputSequenceNumber: JsonField<String>? = null
                private var inputSource: JsonField<String>? = null
                private var instructionIdentification: JsonField<String>? = null
                private var returnReasonAdditionalInformation: JsonField<String>? = null
                private var returnReasonCode: JsonField<String>? = null
                private var returnReasonCodeDescription: JsonField<String>? = null
                private var transactionId: JsonField<String>? = null
                private var wireTransferId: JsonField<String>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(inboundWireReversal: InboundWireReversal) = apply {
                    amount = inboundWireReversal.amount
                    createdAt = inboundWireReversal.createdAt
                    debtorRoutingNumber = inboundWireReversal.debtorRoutingNumber
                    description = inboundWireReversal.description
                    inputCycleDate = inboundWireReversal.inputCycleDate
                    inputMessageAccountabilityData =
                        inboundWireReversal.inputMessageAccountabilityData
                    inputSequenceNumber = inboundWireReversal.inputSequenceNumber
                    inputSource = inboundWireReversal.inputSource
                    instructionIdentification = inboundWireReversal.instructionIdentification
                    returnReasonAdditionalInformation =
                        inboundWireReversal.returnReasonAdditionalInformation
                    returnReasonCode = inboundWireReversal.returnReasonCode
                    returnReasonCodeDescription = inboundWireReversal.returnReasonCodeDescription
                    transactionId = inboundWireReversal.transactionId
                    wireTransferId = inboundWireReversal.wireTransferId
                    additionalProperties = inboundWireReversal.additionalProperties.toMutableMap()
                }

                /** The amount that was reversed in USD 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 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the
                 * reversal 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 debtor's routing number. */
                fun debtorRoutingNumber(debtorRoutingNumber: String?) =
                    debtorRoutingNumber(JsonField.ofNullable(debtorRoutingNumber))

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

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

                /**
                 * The description on the reversal message from Fedwire, set by the reversing bank.
                 */
                fun description(description: String) = description(JsonField.of(description))

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

                /**
                 * The Fedwire cycle date for the wire reversal. The "Fedwire day" begins at 9:00 PM
                 * Eastern Time on the evening before the `cycle date`.
                 */
                fun inputCycleDate(inputCycleDate: LocalDate) =
                    inputCycleDate(JsonField.of(inputCycleDate))

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

                /** The Fedwire transaction identifier. */
                fun inputMessageAccountabilityData(inputMessageAccountabilityData: String) =
                    inputMessageAccountabilityData(JsonField.of(inputMessageAccountabilityData))

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

                /** The Fedwire sequence number. */
                fun inputSequenceNumber(inputSequenceNumber: String) =
                    inputSequenceNumber(JsonField.of(inputSequenceNumber))

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

                /** The Fedwire input source identifier. */
                fun inputSource(inputSource: String) = inputSource(JsonField.of(inputSource))

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

                /** The sending bank's identifier for the reversal. */
                fun instructionIdentification(instructionIdentification: String?) =
                    instructionIdentification(JsonField.ofNullable(instructionIdentification))

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

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

                /** Additional information about the reason for the reversal. */
                fun returnReasonAdditionalInformation(returnReasonAdditionalInformation: String?) =
                    returnReasonAdditionalInformation(
                        JsonField.ofNullable(returnReasonAdditionalInformation)
                    )

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

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

                /**
                 * A code provided by the sending bank giving a reason for the reversal. The common
                 * return reason codes are
                 * [documented here](/documentation/wire-reversals#reversal-reason-codes).
                 */
                fun returnReasonCode(returnReasonCode: String?) =
                    returnReasonCode(JsonField.ofNullable(returnReasonCode))

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

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

                /** An Increase-generated description of the `return_reason_code`. */
                fun returnReasonCodeDescription(returnReasonCodeDescription: String?) =
                    returnReasonCodeDescription(JsonField.ofNullable(returnReasonCodeDescription))

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

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

                /** The ID for the Transaction associated with the transfer reversal. */
                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
                }

                /** The ID for the Wire Transfer that is being reversed. */
                fun wireTransferId(wireTransferId: String) =
                    wireTransferId(JsonField.of(wireTransferId))

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

                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 [InboundWireReversal].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .createdAt()
                 * .debtorRoutingNumber()
                 * .description()
                 * .inputCycleDate()
                 * .inputMessageAccountabilityData()
                 * .inputSequenceNumber()
                 * .inputSource()
                 * .instructionIdentification()
                 * .returnReasonAdditionalInformation()
                 * .returnReasonCode()
                 * .returnReasonCodeDescription()
                 * .transactionId()
                 * .wireTransferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): InboundWireReversal =
                    InboundWireReversal(
                        checkRequired("amount", amount),
                        checkRequired("createdAt", createdAt),
                        checkRequired("debtorRoutingNumber", debtorRoutingNumber),
                        checkRequired("description", description),
                        checkRequired("inputCycleDate", inputCycleDate),
                        checkRequired(
                            "inputMessageAccountabilityData",
                            inputMessageAccountabilityData,
                        ),
                        checkRequired("inputSequenceNumber", inputSequenceNumber),
                        checkRequired("inputSource", inputSource),
                        checkRequired("instructionIdentification", instructionIdentification),
                        checkRequired(
                            "returnReasonAdditionalInformation",
                            returnReasonAdditionalInformation,
                        ),
                        checkRequired("returnReasonCode", returnReasonCode),
                        checkRequired("returnReasonCodeDescription", returnReasonCodeDescription),
                        checkRequired("transactionId", transactionId),
                        checkRequired("wireTransferId", wireTransferId),
                        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(): InboundWireReversal = apply {
                if (validated) {
                    return@apply
                }

                amount()
                createdAt()
                debtorRoutingNumber()
                description()
                inputCycleDate()
                inputMessageAccountabilityData()
                inputSequenceNumber()
                inputSource()
                instructionIdentification()
                returnReasonAdditionalInformation()
                returnReasonCode()
                returnReasonCodeDescription()
                transactionId()
                wireTransferId()
                validated = true
            }

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

            /**
             * Returns 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) +
                    (if (debtorRoutingNumber.asKnown().isPresent) 1 else 0) +
                    (if (description.asKnown().isPresent) 1 else 0) +
                    (if (inputCycleDate.asKnown().isPresent) 1 else 0) +
                    (if (inputMessageAccountabilityData.asKnown().isPresent) 1 else 0) +
                    (if (inputSequenceNumber.asKnown().isPresent) 1 else 0) +
                    (if (inputSource.asKnown().isPresent) 1 else 0) +
                    (if (instructionIdentification.asKnown().isPresent) 1 else 0) +
                    (if (returnReasonAdditionalInformation.asKnown().isPresent) 1 else 0) +
                    (if (returnReasonCode.asKnown().isPresent) 1 else 0) +
                    (if (returnReasonCodeDescription.asKnown().isPresent) 1 else 0) +
                    (if (transactionId.asKnown().isPresent) 1 else 0) +
                    (if (wireTransferId.asKnown().isPresent) 1 else 0)

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

                return other is InboundWireReversal &&
                    amount == other.amount &&
                    createdAt == other.createdAt &&
                    debtorRoutingNumber == other.debtorRoutingNumber &&
                    description == other.description &&
                    inputCycleDate == other.inputCycleDate &&
                    inputMessageAccountabilityData == other.inputMessageAccountabilityData &&
                    inputSequenceNumber == other.inputSequenceNumber &&
                    inputSource == other.inputSource &&
                    instructionIdentification == other.instructionIdentification &&
                    returnReasonAdditionalInformation == other.returnReasonAdditionalInformation &&
                    returnReasonCode == other.returnReasonCode &&
                    returnReasonCodeDescription == other.returnReasonCodeDescription &&
                    transactionId == other.transactionId &&
                    wireTransferId == other.wireTransferId &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    amount,
                    createdAt,
                    debtorRoutingNumber,
                    description,
                    inputCycleDate,
                    inputMessageAccountabilityData,
                    inputSequenceNumber,
                    inputSource,
                    instructionIdentification,
                    returnReasonAdditionalInformation,
                    returnReasonCode,
                    returnReasonCodeDescription,
                    transactionId,
                    wireTransferId,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "InboundWireReversal{amount=$amount, createdAt=$createdAt, debtorRoutingNumber=$debtorRoutingNumber, description=$description, inputCycleDate=$inputCycleDate, inputMessageAccountabilityData=$inputMessageAccountabilityData, inputSequenceNumber=$inputSequenceNumber, inputSource=$inputSource, instructionIdentification=$instructionIdentification, returnReasonAdditionalInformation=$returnReasonAdditionalInformation, returnReasonCode=$returnReasonCode, returnReasonCodeDescription=$returnReasonCodeDescription, transactionId=$transactionId, wireTransferId=$wireTransferId, additionalProperties=$additionalProperties}"
        }

        /**
         * An Inbound Wire Transfer Intention object. This field will be present in the JSON
         * response if and only if `category` is equal to `inbound_wire_transfer`. An Inbound Wire
         * Transfer Intention is created when a wire transfer is initiated at another bank and
         * received by Increase.
         */
        class InboundWireTransfer
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val amount: JsonField<Long>,
            private val creditorAddressLine1: JsonField<String>,
            private val creditorAddressLine2: JsonField<String>,
            private val creditorAddressLine3: JsonField<String>,
            private val creditorName: JsonField<String>,
            private val debtorAddressLine1: JsonField<String>,
            private val debtorAddressLine2: JsonField<String>,
            private val debtorAddressLine3: JsonField<String>,
            private val debtorName: JsonField<String>,
            private val description: JsonField<String>,
            private val endToEndIdentification: JsonField<String>,
            private val inputMessageAccountabilityData: JsonField<String>,
            private val instructingAgentRoutingNumber: JsonField<String>,
            private val instructionIdentification: JsonField<String>,
            private val purpose: JsonField<String>,
            private val transferId: JsonField<String>,
            private val uniqueEndToEndTransactionReference: JsonField<String>,
            private val unstructuredRemittanceInformation: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("creditor_address_line1")
                @ExcludeMissing
                creditorAddressLine1: JsonField<String> = JsonMissing.of(),
                @JsonProperty("creditor_address_line2")
                @ExcludeMissing
                creditorAddressLine2: JsonField<String> = JsonMissing.of(),
                @JsonProperty("creditor_address_line3")
                @ExcludeMissing
                creditorAddressLine3: JsonField<String> = JsonMissing.of(),
                @JsonProperty("creditor_name")
                @ExcludeMissing
                creditorName: JsonField<String> = JsonMissing.of(),
                @JsonProperty("debtor_address_line1")
                @ExcludeMissing
                debtorAddressLine1: JsonField<String> = JsonMissing.of(),
                @JsonProperty("debtor_address_line2")
                @ExcludeMissing
                debtorAddressLine2: JsonField<String> = JsonMissing.of(),
                @JsonProperty("debtor_address_line3")
                @ExcludeMissing
                debtorAddressLine3: JsonField<String> = JsonMissing.of(),
                @JsonProperty("debtor_name")
                @ExcludeMissing
                debtorName: JsonField<String> = JsonMissing.of(),
                @JsonProperty("description")
                @ExcludeMissing
                description: JsonField<String> = JsonMissing.of(),
                @JsonProperty("end_to_end_identification")
                @ExcludeMissing
                endToEndIdentification: JsonField<String> = JsonMissing.of(),
                @JsonProperty("input_message_accountability_data")
                @ExcludeMissing
                inputMessageAccountabilityData: JsonField<String> = JsonMissing.of(),
                @JsonProperty("instructing_agent_routing_number")
                @ExcludeMissing
                instructingAgentRoutingNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("instruction_identification")
                @ExcludeMissing
                instructionIdentification: JsonField<String> = JsonMissing.of(),
                @JsonProperty("purpose")
                @ExcludeMissing
                purpose: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transfer_id")
                @ExcludeMissing
                transferId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("unique_end_to_end_transaction_reference")
                @ExcludeMissing
                uniqueEndToEndTransactionReference: JsonField<String> = JsonMissing.of(),
                @JsonProperty("unstructured_remittance_information")
                @ExcludeMissing
                unstructuredRemittanceInformation: JsonField<String> = JsonMissing.of(),
            ) : this(
                amount,
                creditorAddressLine1,
                creditorAddressLine2,
                creditorAddressLine3,
                creditorName,
                debtorAddressLine1,
                debtorAddressLine2,
                debtorAddressLine3,
                debtorName,
                description,
                endToEndIdentification,
                inputMessageAccountabilityData,
                instructingAgentRoutingNumber,
                instructionIdentification,
                purpose,
                transferId,
                uniqueEndToEndTransactionReference,
                unstructuredRemittanceInformation,
                mutableMapOf(),
            )

            /**
             * The amount in USD 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")

            /**
             * A free-form address field set by the sender.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun creditorAddressLine1(): Optional<String> =
                creditorAddressLine1.getOptional("creditor_address_line1")

            /**
             * A free-form address field set by the sender.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun creditorAddressLine2(): Optional<String> =
                creditorAddressLine2.getOptional("creditor_address_line2")

            /**
             * A free-form address field set by the sender.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun creditorAddressLine3(): Optional<String> =
                creditorAddressLine3.getOptional("creditor_address_line3")

            /**
             * A name set by the sender.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun creditorName(): Optional<String> = creditorName.getOptional("creditor_name")

            /**
             * A free-form address field set by the sender.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun debtorAddressLine1(): Optional<String> =
                debtorAddressLine1.getOptional("debtor_address_line1")

            /**
             * A free-form address field set by the sender.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun debtorAddressLine2(): Optional<String> =
                debtorAddressLine2.getOptional("debtor_address_line2")

            /**
             * A free-form address field set by the sender.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun debtorAddressLine3(): Optional<String> =
                debtorAddressLine3.getOptional("debtor_address_line3")

            /**
             * A name set by the sender.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun debtorName(): Optional<String> = debtorName.getOptional("debtor_name")

            /**
             * An Increase-constructed description of the transfer.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun description(): String = description.getRequired("description")

            /**
             * A free-form reference string set by the sender, to help identify the transfer.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun endToEndIdentification(): Optional<String> =
                endToEndIdentification.getOptional("end_to_end_identification")

            /**
             * A unique identifier available to the originating and receiving banks, commonly
             * abbreviated as IMAD. It is created when the wire is submitted to the Fedwire service
             * and is helpful when debugging wires with the originating bank.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun inputMessageAccountabilityData(): Optional<String> =
                inputMessageAccountabilityData.getOptional("input_message_accountability_data")

            /**
             * The American Banking Association (ABA) routing number of the bank that sent the wire.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun instructingAgentRoutingNumber(): Optional<String> =
                instructingAgentRoutingNumber.getOptional("instructing_agent_routing_number")

            /**
             * The sending bank's identifier for the wire transfer.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun instructionIdentification(): Optional<String> =
                instructionIdentification.getOptional("instruction_identification")

            /**
             * The reason for the wire transfer, as set by the sender.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun purpose(): Optional<String> = purpose.getOptional("purpose")

            /**
             * The ID of the Inbound Wire Transfer object that resulted in 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 transferId(): String = transferId.getRequired("transfer_id")

            /**
             * The Unique End-to-end Transaction Reference
             * ([UETR](https://www.swift.com/payments/what-unique-end-end-transaction-reference-uetr))
             * of the transfer.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun uniqueEndToEndTransactionReference(): Optional<String> =
                uniqueEndToEndTransactionReference.getOptional(
                    "unique_end_to_end_transaction_reference"
                )

            /**
             * A free-form message set by the sender.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
             *   if the server responded with an unexpected value).
             */
            fun unstructuredRemittanceInformation(): Optional<String> =
                unstructuredRemittanceInformation.getOptional("unstructured_remittance_information")

            /**
             * 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 [creditorAddressLine1].
             *
             * Unlike [creditorAddressLine1], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("creditor_address_line1")
            @ExcludeMissing
            fun _creditorAddressLine1(): JsonField<String> = creditorAddressLine1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            @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 [InboundWireTransfer].
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .creditorAddressLine1()
                 * .creditorAddressLine2()
                 * .creditorAddressLine3()
                 * .creditorName()
                 * .debtorAddressLine1()
                 * .debtorAddressLine2()
                 * .debtorAddressLine3()
                 * .debtorName()
                 * .description()
                 * .endToEndIdentification()
                 * .inputMessageAccountabilityData()
                 * .instructingAgentRoutingNumber()
                 * .instructionIdentification()
                 * .purpose()
                 * .transferId()
                 * .uniqueEndToEndTransactionReference()
                 * .unstructuredRemittanceInformation()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var amount: JsonField<Long>? = null
                private var creditorAddressLine1: JsonField<String>? = null
                private var creditorAddressLine2: JsonField<String>? = null
                private var creditorAddressLine3: JsonField<String>? = null
                private var creditorName: JsonField<String>? = null
                private var debtorAddressLine1: JsonField<String>? = null
                private var debtorAddressLine2: JsonField<String>? = null
                private var debtorAddressLine3: JsonField<String>? = null
                private var debtorName: JsonField<String>? = null
                private var description: JsonField<String>? = null
                private var endToEndIdentification: JsonField<String>? = null
                private var inputMessageAccountabilityData: JsonField<String>? = null
                private var instructingAgentRoutingNumber: JsonField<String>? = null
                private var instructionIdentification: JsonField<String>? = null
                private var purpose: JsonField<String>? = null
                private var transferId: JsonField<String>? = null
                private var uniqueEndToEndTransactionReference: JsonField<String>? = null
                private var unstructuredRemittanceInformation: JsonField<String>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(inboundWireTransfer: InboundWireTransfer) = apply {
                    amount = inboundWireTransfer.amount
                    creditorAddressLine1 = inboundWireTransfer.creditorAddressLine1
                    creditorAddressLine2 = inboundWireTransfer.creditorAddressLine2
                    creditorAddressLine3 = inboundWireTransfer.creditorAddressLine3
                    creditorName = inboundWireTransfer.creditorName
                    debtorAddressLine1 = inboundWireTransfer.debtorAddressLine1
                    debtorAddressLine2 = inboundWireTransfer.debtorAddressLine2
                    debtorAddressLine3 = inboundWireTransfer.debtorAddressLine3
                    debtorName = inboundWireTransfer.debtorName
                    description = inboundWireTransfer.description
                    endToEndIdentification = inboundWireTransfer.endToEndIdentification
                    inputMessageAccountabilityData =
                        inboundWireTransfer.inputMessageAccountabilityData
                    instructingAgentRoutingNumber =
                        inboundWireTransfer.instructingAgentRoutingNumber
                    instructionIdentification = inboundWireTransfer.instructionIdentification
                    purpose = inboundWireTransfer.purpose
                    transferId = inboundWireTransfer.transferId
                    uniqueEndToEndTransactionReference =
                        inboundWireTransfer.uniqueEndToEndTransactionReference
                    unstructuredRemittanceInformation =
                        inboundWireTransfer.unstructuredRemittanceInformation
                    additionalProperties = inboundWireTransfer.additionalProperties.toMutableMap()
                }

                /** The amount in USD 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 }

                /** A free-form address field set by the sender. */
                fun creditorAddressLine1(creditorAddressLine1: String?) =
                    creditorAddressLine1(JsonField.ofNullable(creditorAddressLine1))

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

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

                /** A free-form address field set by the sender. */
                fun creditorAddressLine2(creditorAddressLine2: String?) =
                    creditorAddressLine2(JsonField.ofNullable(creditorAddressLine2))

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

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

                /** A free-form address field set by the sender. */
                fun creditorAddressLine3(creditorAddressLine3: String?) =
                    creditorAddressLine3(JsonField.ofNullable(creditorAddressLine3))

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

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

                /** A name set by the sender. */
                fun creditorName(creditorName: String?) =
                    creditorName(JsonField.ofNullable(creditorName))

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

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

                /** A free-form address field set by the sender. */
                fun debtorAddressLine1(debtorAddressLine1: String?) =
                    debtorAddressLine1(JsonField.ofNullable(debtorAddressLine1))

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

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

                /** A free-form address field set by the sender. */
                fun debtorAddressLine2(debtorAddressLine2: String?) =
                    debtorAddressLine2(JsonField.ofNullable(debtorAddressLine2))

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

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

                /** A free-form address field set by the sender. */
                fun debtorAddressLine3(debtorAddressLine3: String?) =
                    debtorAddressLine3(JsonField.ofNullable(debtorAddressLine3))

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

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

                /** A name set by the sender. */
                fun debtorName(debtorName: String?) = debtorName(JsonField.ofNullable(debtorName))

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

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

                /** An Increase-constructed description of the transfer. */
                fun description(description: String) = description(JsonField.of(description))

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

                /**
                 * A free-form reference string set by the sender, to help identify the transfer.
                 */
                fun endToEndIdentification(endToEndIdentification: String?) =
                    endToEndIdentification(JsonField.ofNullable(endToEndIdentification))

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

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

                /**
                 * A unique identifier available to the originating and receiving banks, commonly
                 * abbreviated as IMAD. It is created when the wire is submitted to the Fedwire
                 * service and is helpful when debugging wires with the originating bank.
                 */
                fun inputMessageAccountabilityData(inputMessageAccountabilityData: String?) =
                    inputMessageAccountabilityData(
                        JsonField.ofNullable(inputMessageAccountabilityData)
                    )

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

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

                /**
                 * The American Banking Association (ABA) routing number of the bank that sent the
                 * wire.
                 */
                fun instructingAgentRoutingNumber(instructingAgentRoutingNumber: String?) =
                    instructingAgentRoutingNumber(
                        JsonField.ofNullable(instructingAgentRoutingNumber)
                    )

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

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

                /** The sending bank's identifier for the wire transfer. */
                fun instructionIdentification(instructionIdentification: String?) =
                    instructionIdentification(JsonField.ofNullable(instructionIdentification))

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

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

                /** The reason for the wire transfer, as set by the sender. */
                fun purpose(purpose: String?) = purpose(JsonField.ofNullable(purpose))

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

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

                /** The ID of the Inbound Wire Transfer object that resulted in this Transaction. */
                fun transferId(transferId: String) = transferId(JsonField.of(transferId))

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

                /**
                 * The Unique End-to-end Transaction Reference
                 * ([UETR](https://www.swift.com/payments/what-unique-end-end-transaction-reference-uetr))
                 * of the transfer.
                 */
                fun uniqueEndToEndTransactionReference(
                    uniqueEndToEndTransactionReference: String?
                ) =
                    uniqueEndToEndTransactionReference(
                        JsonField.ofNullable(uniqueEndToEndTransactionReference)
                    )

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

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

                /** A free-form message set by the sender. */
                fun unstructuredRemittanceInformation(unstructuredRemittanceInformation: String?) =
                    unstructuredRemittanceInformation(
                        JsonField.ofNullable(unstructuredRemittanceInformation)
                    )

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

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

                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 [InboundWireTransfer].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .creditorAddressLine1()
                 * .creditorAddressLine2()
                 * .creditorAddressLine3()
                 * .creditorName()
                 * .debtorAddressLine1()
                 * .debtorAddressLine2()
                 * .debtorAddressLine3()
                 * .debtorName()
                 * .description()
                 * .endToEndIdentification()
                 * .inputMessageAccountabilityData()
                 * .instructingAgentRoutingNumber()
                 * .instructionIdentification()
                 * .purpose()
                 * .transferId()
                 * .uniqueEndToEndTransactionReference()
                 * .unstructuredRemittanceInformation()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): InboundWireTransfer =
                    InboundWireTransfer(
                        checkRequired("amount", amount),
                        checkRequired("creditorAddressLine1", creditorAddressLine1),
                        checkRequired("creditorAddressLine2", creditorAddressLine2),
                        checkRequired("creditorAddressLine3", creditorAddressLine3),
                        checkRequired("creditorName", creditorName),
                        checkRequired("debtorAddressLine1", debtorAddressLine1),
                        checkRequired("debtorAddressLine2", debtorAddressLine2),
                        checkRequired("debtorAddressLine3", debtorAddressLine3),
                        checkRequired("debtorName", debtorName),
                        checkRequired("description", description),
                        checkRequired("endToEndIdentification", endToEndIdentification),
                        checkRequired(
                            "inputMessageAccountabilityData",
                            inputMessageAccountabilityData,
                        ),
                        checkRequired(
                            "instructingAgentRoutingNumber",
                            instructingAgentRoutingNumber,
                        ),
                        checkRequired("instructionIdentification", instructionIdentification),
                        checkRequired("purpose", purpose),
                        checkRequired("transferId", transferId),
                        checkRequired(
                            "uniqueEndToEndTransactionReference",
                            uniqueEndToEndTransactionReference,
                        ),
                        checkRequired(
                            "unstructuredRemittanceInformation",
                            unstructuredRemittanceInformation,
                        ),
                        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(): InboundWireTransfer = apply {
                if (validated) {
                    return@apply
                }

                amount()
                creditorAddressLine1()
                creditorAddressLine2()
                creditorAddressLine3()
                creditorName()
                debtorAddressLine1()
                debtorAddressLine2()
                debtorAddressLine3()
                debtorName()
                description()
                endToEndIdentification()
                inputMessageAccountabilityData()
                instructingAgentRoutingNumber()
                instructionIdentification()
                purpose()
                transferId()
                uniqueEndToEndTransactionReference()
                unstructuredRemittanceInformation()
                validated = true
            }

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

            /**
             * Returns 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 (creditorAddressLine1.asKnown().isPresent) 1 else 0) +
                    (if (creditorAddressLine2.asKnown().isPresent) 1 else 0) +
                    (if (creditorAddressLine3.asKnown().isPresent) 1 else 0) +
                    (if (creditorName.asKnown().isPresent) 1 else 0) +
                    (if (debtorAddressLine1.asKnown().isPresent) 1 else 0) +
                    (if (debtorAddressLine2.asKnown().isPresent) 1 else 0) +
                    (if (debtorAddressLine3.asKnown().isPresent) 1 else 0) +
                    (if (debtorName.asKnown().isPresent) 1 else 0) +
                    (if (description.asKnown().isPresent) 1 else 0) +
                    (if (endToEndIdentification.asKnown().isPresent) 1 else 0) +
                    (if (inputMessageAccountabilityData.asKnown().isPresent) 1 else 0) +
                    (if (instructingAgentRoutingNumber.asKnown().isPresent) 1 else 0) +
                    (if (instructionIdentification.asKnown().isPresent) 1 else 0) +
                    (if (purpose.asKnown().isPresent) 1 else 0) +
                    (if (transferId.asKnown().isPresent) 1 else 0) +
                    (if (uniqueEndToEndTransactionReference.asKnown().isPresent) 1 else 0) +
                    (if (unstructuredRemittanceInformation.asKnown().isPresent) 1 else 0)

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

                return other is InboundWireTransfer &&
                    amount == other.amount &&
                    creditorAddressLine1 == other.creditorAddressLine1 &&
                    creditorAddressLine2 == other.creditorAddressLine2 &&
                    creditorAddressLine3 == other.creditorAddressLine3 &&
                    creditorName == other.creditorName &&
                    debtorAddressLine1 == other.debtorAddressLine1 &&
                    debtorAddressLine2 == other.debtorAddressLine2 &&
                    debtorAddressLine3 == other.debtorAddressLine3 &&
                    debtorName == other.debtorName &&
                    description == other.description &&
                    endToEndIdentification == other.endToEndIdentification &&
                    inputMessageAccountabilityData == other.inputMessageAccountabilityData &&
                    instructingAgentRoutingNumber == other.instructingAgentRoutingNumber &&
                    instructionIdentification == other.instructionIdentification &&
                    purpose == other.purpose &&
                    transferId == other.transferId &&
                    uniqueEndToEndTransactionReference ==
                        other.uniqueEndToEndTransactionReference &&
                    unstructuredRemittanceInformation == other.unstructuredRemittanceInformation &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    amount,
                    creditorAddressLine1,
                    creditorAddressLine2,
                    creditorAddressLine3,
                    creditorName,
                    debtorAddressLine1,
                    debtorAddressLine2,
                    debtorAddressLine3,
                    debtorName,
                    description,
                    endToEndIdentification,
                    inputMessageAccountabilityData,
                    instructingAgentRoutingNumber,
                    instructionIdentification,
                    purpose,
                    transferId,
                    uniqueEndToEndTransactionReference,
                    unstructuredRemittanceInformation,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "InboundWireTransfer{amount=$amount, creditorAddressLine1=$creditorAddressLine1, creditorAddressLine2=$creditorAddressLine2, creditorAddressLine3=$creditorAddressLine3, creditorName=$creditorName, debtorAddressLine1=$debtorAddressLine1, debtorAddressLine2=$debtorAddressLine2, debtorAddressLine3=$debtorAddressLine3, debtorName=$debtorName, description=$description, endToEndIdentification=$endToEndIdentification, inputMessageAccountabilityData=$inputMessageAccountabilityData, instructingAgentRoutingNumber=$instructingAgentRoutingNumber, instructionIdentification=$instructionIdentification, purpose=$purpose, transferId=$transferId, uniqueEndToEndTransactionReference=$uniqueEndToEndTransactionReference, unstructuredRemittanceInformation=$unstructuredRemittanceInformation, additionalProperties=$additionalProperties}"
        }

        /**
         * An Inbound Wire Transfer Reversal Intention object. This field will be present in the
         * JSON response if and only if `category` is equal to `inbound_wire_transfer_reversal`. An
         * Inbound Wire Transfer Reversal Intention is created when Increase has received a wire and
         * the User requests that it be reversed.
         */
        class InboundWireTransferReversal
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val inboundWireTransferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

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

            /**
             * The ID of the Inbound Wire Transfer that is being reversed.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun inboundWireTransferId(): String =
                inboundWireTransferId.getRequired("inbound_wire_transfer_id")

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

            @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
                 * [InboundWireTransferReversal].
                 *
                 * The following fields are required:
                 * ```java
                 * .inboundWireTransferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

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

                @JvmSynthetic
                internal fun from(inboundWireTransferReversal: InboundWireTransferReversal) =
                    apply {
                        inboundWireTransferId = inboundWireTransferReversal.inboundWireTransferId
                        additionalProperties =
                            inboundWireTransferReversal.additionalProperties.toMutableMap()
                    }

                /** The ID of the Inbound Wire Transfer that is being reversed. */
                fun inboundWireTransferId(inboundWireTransferId: String) =
                    inboundWireTransferId(JsonField.of(inboundWireTransferId))

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

                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 [InboundWireTransferReversal].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .inboundWireTransferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): InboundWireTransferReversal =
                    InboundWireTransferReversal(
                        checkRequired("inboundWireTransferId", inboundWireTransferId),
                        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(): InboundWireTransferReversal = apply {
                if (validated) {
                    return@apply
                }

                inboundWireTransferId()
                validated = true
            }

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

            /**
             * Returns 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 (inboundWireTransferId.asKnown().isPresent) 1 else 0)

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

                return other is InboundWireTransferReversal &&
                    inboundWireTransferId == other.inboundWireTransferId &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "InboundWireTransferReversal{inboundWireTransferId=$inboundWireTransferId, additionalProperties=$additionalProperties}"
        }

        /**
         * An Interest Payment object. This field will be present in the JSON response if and only
         * if `category` is equal to `interest_payment`. An Interest Payment represents a payment of
         * interest on an account. Interest is usually paid monthly.
         */
        class InterestPayment
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val accruedOnAccountId: JsonField<String>,
            private val amount: JsonField<Long>,
            private val currency: JsonField<Currency>,
            private val periodEnd: JsonField<OffsetDateTime>,
            private val periodStart: JsonField<OffsetDateTime>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("accrued_on_account_id")
                @ExcludeMissing
                accruedOnAccountId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("period_end")
                @ExcludeMissing
                periodEnd: JsonField<OffsetDateTime> = JsonMissing.of(),
                @JsonProperty("period_start")
                @ExcludeMissing
                periodStart: JsonField<OffsetDateTime> = JsonMissing.of(),
            ) : this(accruedOnAccountId, amount, currency, periodEnd, periodStart, mutableMapOf())

            /**
             * The account on which the interest was accrued.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun accruedOnAccountId(): String =
                accruedOnAccountId.getRequired("accrued_on_account_id")

            /**
             * The 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction
             * 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 end of the period for which this transaction paid interest.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun periodEnd(): OffsetDateTime = periodEnd.getRequired("period_end")

            /**
             * The start of the period for which this transaction paid interest.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun periodStart(): OffsetDateTime = periodStart.getRequired("period_start")

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

            /**
             * 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<Currency> = currency

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

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

            @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 [InterestPayment].
                 *
                 * The following fields are required:
                 * ```java
                 * .accruedOnAccountId()
                 * .amount()
                 * .currency()
                 * .periodEnd()
                 * .periodStart()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var accruedOnAccountId: JsonField<String>? = null
                private var amount: JsonField<Long>? = null
                private var currency: JsonField<Currency>? = null
                private var periodEnd: JsonField<OffsetDateTime>? = null
                private var periodStart: JsonField<OffsetDateTime>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(interestPayment: InterestPayment) = apply {
                    accruedOnAccountId = interestPayment.accruedOnAccountId
                    amount = interestPayment.amount
                    currency = interestPayment.currency
                    periodEnd = interestPayment.periodEnd
                    periodStart = interestPayment.periodStart
                    additionalProperties = interestPayment.additionalProperties.toMutableMap()
                }

                /** The account on which the interest was accrued. */
                fun accruedOnAccountId(accruedOnAccountId: String) =
                    accruedOnAccountId(JsonField.of(accruedOnAccountId))

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

                /**
                 * The 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction
                 * 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 end of the period for which this transaction paid interest. */
                fun periodEnd(periodEnd: OffsetDateTime) = periodEnd(JsonField.of(periodEnd))

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

                /** The start of the period for which this transaction paid interest. */
                fun periodStart(periodStart: OffsetDateTime) =
                    periodStart(JsonField.of(periodStart))

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

                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 [InterestPayment].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .accruedOnAccountId()
                 * .amount()
                 * .currency()
                 * .periodEnd()
                 * .periodStart()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): InterestPayment =
                    InterestPayment(
                        checkRequired("accruedOnAccountId", accruedOnAccountId),
                        checkRequired("amount", amount),
                        checkRequired("currency", currency),
                        checkRequired("periodEnd", periodEnd),
                        checkRequired("periodStart", periodStart),
                        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(): InterestPayment = apply {
                if (validated) {
                    return@apply
                }

                accruedOnAccountId()
                amount()
                currency().validate()
                periodEnd()
                periodStart()
                validated = true
            }

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

            /**
             * Returns 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 (accruedOnAccountId.asKnown().isPresent) 1 else 0) +
                    (if (amount.asKnown().isPresent) 1 else 0) +
                    (currency.asKnown().getOrNull()?.validity() ?: 0) +
                    (if (periodEnd.asKnown().isPresent) 1 else 0) +
                    (if (periodStart.asKnown().isPresent) 1 else 0)

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction
             * 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()
            }

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

                return other is InterestPayment &&
                    accruedOnAccountId == other.accruedOnAccountId &&
                    amount == other.amount &&
                    currency == other.currency &&
                    periodEnd == other.periodEnd &&
                    periodStart == other.periodStart &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    accruedOnAccountId,
                    amount,
                    currency,
                    periodEnd,
                    periodStart,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "InterestPayment{accruedOnAccountId=$accruedOnAccountId, amount=$amount, currency=$currency, periodEnd=$periodEnd, periodStart=$periodStart, additionalProperties=$additionalProperties}"
        }

        /**
         * An Internal Source object. This field will be present in the JSON response if and only if
         * `category` is equal to `internal_source`. A transaction between the user and Increase.
         * See the `reason` attribute for more information.
         */
        class InternalSource
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val amount: JsonField<Long>,
            private val currency: JsonField<Currency>,
            private val reason: JsonField<Reason>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("currency")
                @ExcludeMissing
                currency: JsonField<Currency> = JsonMissing.of(),
                @JsonProperty("reason") @ExcludeMissing reason: JsonField<Reason> = JsonMissing.of(),
            ) : this(amount, currency, reason, mutableMapOf())

            /**
             * The 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction
             * 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")

            /**
             * An Internal Source is a transaction between you and Increase. This describes the
             * reason 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 reason(): Reason = reason.getRequired("reason")

            /**
             * 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<Currency> = currency

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

            @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 [InternalSource].
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .currency()
                 * .reason()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var amount: JsonField<Long>? = null
                private var currency: JsonField<Currency>? = null
                private var reason: JsonField<Reason>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(internalSource: InternalSource) = apply {
                    amount = internalSource.amount
                    currency = internalSource.currency
                    reason = internalSource.reason
                    additionalProperties = internalSource.additionalProperties.toMutableMap()
                }

                /**
                 * The 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction
                 * 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 }

                /**
                 * An Internal Source is a transaction between you and Increase. This describes the
                 * reason for the transaction.
                 */
                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 }

                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 [InternalSource].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .amount()
                 * .currency()
                 * .reason()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): InternalSource =
                    InternalSource(
                        checkRequired("amount", amount),
                        checkRequired("currency", currency),
                        checkRequired("reason", reason),
                        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(): InternalSource = apply {
                if (validated) {
                    return@apply
                }

                amount()
                currency().validate()
                reason().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) +
                    (reason.asKnown().getOrNull()?.validity() ?: 0)

            /**
             * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction
             * 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()
            }

            /**
             * An Internal Source is a transaction between you and Increase. This describes the
             * reason for the transaction.
             */
            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 {

                    /** Account closure */
                    @JvmField val ACCOUNT_CLOSURE = of("account_closure")

                    /** Account revenue payment distribution */
                    @JvmField
                    val ACCOUNT_REVENUE_PAYMENT_DISTRIBUTION =
                        of("account_revenue_payment_distribution")

                    /** Bank-drawn check */
                    @JvmField val BANK_DRAWN_CHECK = of("bank_drawn_check")

                    /** Bank-drawn check credit */
                    @JvmField val BANK_DRAWN_CHECK_CREDIT = of("bank_drawn_check_credit")

                    /** Bank migration */
                    @JvmField val BANK_MIGRATION = of("bank_migration")

                    /** Check adjustment */
                    @JvmField val CHECK_ADJUSTMENT = of("check_adjustment")

                    /** Collection payment */
                    @JvmField val COLLECTION_PAYMENT = of("collection_payment")

                    /** Collection receivable */
                    @JvmField val COLLECTION_RECEIVABLE = of("collection_receivable")

                    /** Dishonored ACH return */
                    @JvmField val DISHONORED_ACH_RETURN = of("dishonored_ach_return")

                    /** Empyreal adjustment */
                    @JvmField val EMPYREAL_ADJUSTMENT = of("empyreal_adjustment")

                    /** Error */
                    @JvmField val ERROR = of("error")

                    /** Error correction */
                    @JvmField val ERROR_CORRECTION = of("error_correction")

                    /** Fees */
                    @JvmField val FEES = of("fees")

                    /** General ledger transfer */
                    @JvmField val GENERAL_LEDGER_TRANSFER = of("general_ledger_transfer")

                    /** Interest */
                    @JvmField val INTEREST = of("interest")

                    /** Negative balance forgiveness */
                    @JvmField val NEGATIVE_BALANCE_FORGIVENESS = of("negative_balance_forgiveness")

                    /** Sample funds */
                    @JvmField val SAMPLE_FUNDS = of("sample_funds")

                    /** Sample funds return */
                    @JvmField val SAMPLE_FUNDS_RETURN = of("sample_funds_return")

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

                /** An enum containing [Reason]'s known values. */
                enum class Known {
                    /** Account closure */
                    ACCOUNT_CLOSURE,
                    /** Account revenue payment distribution */
                    ACCOUNT_REVENUE_PAYMENT_DISTRIBUTION,
                    /** Bank-drawn check */
                    BANK_DRAWN_CHECK,
                    /** Bank-drawn check credit */
                    BANK_DRAWN_CHECK_CREDIT,
                    /** Bank migration */
                    BANK_MIGRATION,
                    /** Check adjustment */
                    CHECK_ADJUSTMENT,
                    /** Collection payment */
                    COLLECTION_PAYMENT,
                    /** Collection receivable */
                    COLLECTION_RECEIVABLE,
                    /** Dishonored ACH return */
                    DISHONORED_ACH_RETURN,
                    /** Empyreal adjustment */
                    EMPYREAL_ADJUSTMENT,
                    /** Error */
                    ERROR,
                    /** Error correction */
                    ERROR_CORRECTION,
                    /** Fees */
                    FEES,
                    /** General ledger transfer */
                    GENERAL_LEDGER_TRANSFER,
                    /** Interest */
                    INTEREST,
                    /** Negative balance forgiveness */
                    NEGATIVE_BALANCE_FORGIVENESS,
                    /** Sample funds */
                    SAMPLE_FUNDS,
                    /** Sample funds return */
                    SAMPLE_FUNDS_RETURN,
                }

                /**
                 * 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 {
                    /** Account closure */
                    ACCOUNT_CLOSURE,
                    /** Account revenue payment distribution */
                    ACCOUNT_REVENUE_PAYMENT_DISTRIBUTION,
                    /** Bank-drawn check */
                    BANK_DRAWN_CHECK,
                    /** Bank-drawn check credit */
                    BANK_DRAWN_CHECK_CREDIT,
                    /** Bank migration */
                    BANK_MIGRATION,
                    /** Check adjustment */
                    CHECK_ADJUSTMENT,
                    /** Collection payment */
                    COLLECTION_PAYMENT,
                    /** Collection receivable */
                    COLLECTION_RECEIVABLE,
                    /** Dishonored ACH return */
                    DISHONORED_ACH_RETURN,
                    /** Empyreal adjustment */
                    EMPYREAL_ADJUSTMENT,
                    /** Error */
                    ERROR,
                    /** Error correction */
                    ERROR_CORRECTION,
                    /** Fees */
                    FEES,
                    /** General ledger transfer */
                    GENERAL_LEDGER_TRANSFER,
                    /** Interest */
                    INTEREST,
                    /** Negative balance forgiveness */
                    NEGATIVE_BALANCE_FORGIVENESS,
                    /** Sample funds */
                    SAMPLE_FUNDS,
                    /** Sample funds return */
                    SAMPLE_FUNDS_RETURN,
                    /**
                     * 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_CLOSURE -> Value.ACCOUNT_CLOSURE
                        ACCOUNT_REVENUE_PAYMENT_DISTRIBUTION ->
                            Value.ACCOUNT_REVENUE_PAYMENT_DISTRIBUTION
                        BANK_DRAWN_CHECK -> Value.BANK_DRAWN_CHECK
                        BANK_DRAWN_CHECK_CREDIT -> Value.BANK_DRAWN_CHECK_CREDIT
                        BANK_MIGRATION -> Value.BANK_MIGRATION
                        CHECK_ADJUSTMENT -> Value.CHECK_ADJUSTMENT
                        COLLECTION_PAYMENT -> Value.COLLECTION_PAYMENT
                        COLLECTION_RECEIVABLE -> Value.COLLECTION_RECEIVABLE
                        DISHONORED_ACH_RETURN -> Value.DISHONORED_ACH_RETURN
                        EMPYREAL_ADJUSTMENT -> Value.EMPYREAL_ADJUSTMENT
                        ERROR -> Value.ERROR
                        ERROR_CORRECTION -> Value.ERROR_CORRECTION
                        FEES -> Value.FEES
                        GENERAL_LEDGER_TRANSFER -> Value.GENERAL_LEDGER_TRANSFER
                        INTEREST -> Value.INTEREST
                        NEGATIVE_BALANCE_FORGIVENESS -> Value.NEGATIVE_BALANCE_FORGIVENESS
                        SAMPLE_FUNDS -> Value.SAMPLE_FUNDS
                        SAMPLE_FUNDS_RETURN -> Value.SAMPLE_FUNDS_RETURN
                        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_CLOSURE -> Known.ACCOUNT_CLOSURE
                        ACCOUNT_REVENUE_PAYMENT_DISTRIBUTION ->
                            Known.ACCOUNT_REVENUE_PAYMENT_DISTRIBUTION
                        BANK_DRAWN_CHECK -> Known.BANK_DRAWN_CHECK
                        BANK_DRAWN_CHECK_CREDIT -> Known.BANK_DRAWN_CHECK_CREDIT
                        BANK_MIGRATION -> Known.BANK_MIGRATION
                        CHECK_ADJUSTMENT -> Known.CHECK_ADJUSTMENT
                        COLLECTION_PAYMENT -> Known.COLLECTION_PAYMENT
                        COLLECTION_RECEIVABLE -> Known.COLLECTION_RECEIVABLE
                        DISHONORED_ACH_RETURN -> Known.DISHONORED_ACH_RETURN
                        EMPYREAL_ADJUSTMENT -> Known.EMPYREAL_ADJUSTMENT
                        ERROR -> Known.ERROR
                        ERROR_CORRECTION -> Known.ERROR_CORRECTION
                        FEES -> Known.FEES
                        GENERAL_LEDGER_TRANSFER -> Known.GENERAL_LEDGER_TRANSFER
                        INTEREST -> Known.INTEREST
                        NEGATIVE_BALANCE_FORGIVENESS -> Known.NEGATIVE_BALANCE_FORGIVENESS
                        SAMPLE_FUNDS -> Known.SAMPLE_FUNDS
                        SAMPLE_FUNDS_RETURN -> Known.SAMPLE_FUNDS_RETURN
                        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()
            }

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

                return other is InternalSource &&
                    amount == other.amount &&
                    currency == other.currency &&
                    reason == other.reason &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "InternalSource{amount=$amount, currency=$currency, reason=$reason, 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}"
        }

        /**
         * A Real-Time Payments Transfer Acknowledgement object. This field will be present in the
         * JSON response if and only if `category` is equal to
         * `real_time_payments_transfer_acknowledgement`. A Real-Time Payments Transfer
         * Acknowledgement is created when a Real-Time Payments Transfer sent from Increase is
         * acknowledged by the receiving bank.
         */
        class RealTimePaymentsTransferAcknowledgement
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val accountNumber: JsonField<String>,
            private val amount: JsonField<Long>,
            private val routingNumber: JsonField<String>,
            private val transferId: JsonField<String>,
            private val unstructuredRemittanceInformation: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("account_number")
                @ExcludeMissing
                accountNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("routing_number")
                @ExcludeMissing
                routingNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transfer_id")
                @ExcludeMissing
                transferId: JsonField<String> = JsonMissing.of(),
                @JsonProperty("unstructured_remittance_information")
                @ExcludeMissing
                unstructuredRemittanceInformation: JsonField<String> = JsonMissing.of(),
            ) : this(
                accountNumber,
                amount,
                routingNumber,
                transferId,
                unstructuredRemittanceInformation,
                mutableMapOf(),
            )

            /**
             * The destination account 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 accountNumber(): String = accountNumber.getRequired("account_number")

            /**
             * The transfer amount in USD 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 American Bankers' Association (ABA) Routing Transit Number (RTN).
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun routingNumber(): String = routingNumber.getRequired("routing_number")

            /**
             * The identifier of the Real-Time Payments Transfer that led to 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 transferId(): String = transferId.getRequired("transfer_id")

            /**
             * Unstructured information that will show on the recipient's bank statement.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun unstructuredRemittanceInformation(): String =
                unstructuredRemittanceInformation.getRequired("unstructured_remittance_information")

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

            /**
             * 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 [routingNumber].
             *
             * Unlike [routingNumber], this method doesn't throw if the JSON field has an unexpected
             * type.
             */
            @JsonProperty("routing_number")
            @ExcludeMissing
            fun _routingNumber(): JsonField<String> = routingNumber

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

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

            @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
                 * [RealTimePaymentsTransferAcknowledgement].
                 *
                 * The following fields are required:
                 * ```java
                 * .accountNumber()
                 * .amount()
                 * .routingNumber()
                 * .transferId()
                 * .unstructuredRemittanceInformation()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var accountNumber: JsonField<String>? = null
                private var amount: JsonField<Long>? = null
                private var routingNumber: JsonField<String>? = null
                private var transferId: JsonField<String>? = null
                private var unstructuredRemittanceInformation: JsonField<String>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(
                    realTimePaymentsTransferAcknowledgement: RealTimePaymentsTransferAcknowledgement
                ) = apply {
                    accountNumber = realTimePaymentsTransferAcknowledgement.accountNumber
                    amount = realTimePaymentsTransferAcknowledgement.amount
                    routingNumber = realTimePaymentsTransferAcknowledgement.routingNumber
                    transferId = realTimePaymentsTransferAcknowledgement.transferId
                    unstructuredRemittanceInformation =
                        realTimePaymentsTransferAcknowledgement.unstructuredRemittanceInformation
                    additionalProperties =
                        realTimePaymentsTransferAcknowledgement.additionalProperties.toMutableMap()
                }

                /** The destination account number. */
                fun accountNumber(accountNumber: String) =
                    accountNumber(JsonField.of(accountNumber))

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

                /** The transfer amount in USD 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 American Bankers' Association (ABA) Routing Transit Number (RTN). */
                fun routingNumber(routingNumber: String) =
                    routingNumber(JsonField.of(routingNumber))

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

                /**
                 * The identifier of the Real-Time Payments Transfer that led to this Transaction.
                 */
                fun transferId(transferId: String) = transferId(JsonField.of(transferId))

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

                /** Unstructured information that will show on the recipient's bank statement. */
                fun unstructuredRemittanceInformation(unstructuredRemittanceInformation: String) =
                    unstructuredRemittanceInformation(
                        JsonField.of(unstructuredRemittanceInformation)
                    )

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

                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 [RealTimePaymentsTransferAcknowledgement].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .accountNumber()
                 * .amount()
                 * .routingNumber()
                 * .transferId()
                 * .unstructuredRemittanceInformation()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): RealTimePaymentsTransferAcknowledgement =
                    RealTimePaymentsTransferAcknowledgement(
                        checkRequired("accountNumber", accountNumber),
                        checkRequired("amount", amount),
                        checkRequired("routingNumber", routingNumber),
                        checkRequired("transferId", transferId),
                        checkRequired(
                            "unstructuredRemittanceInformation",
                            unstructuredRemittanceInformation,
                        ),
                        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(): RealTimePaymentsTransferAcknowledgement = apply {
                if (validated) {
                    return@apply
                }

                accountNumber()
                amount()
                routingNumber()
                transferId()
                unstructuredRemittanceInformation()
                validated = true
            }

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

            /**
             * Returns 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 (accountNumber.asKnown().isPresent) 1 else 0) +
                    (if (amount.asKnown().isPresent) 1 else 0) +
                    (if (routingNumber.asKnown().isPresent) 1 else 0) +
                    (if (transferId.asKnown().isPresent) 1 else 0) +
                    (if (unstructuredRemittanceInformation.asKnown().isPresent) 1 else 0)

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

                return other is RealTimePaymentsTransferAcknowledgement &&
                    accountNumber == other.accountNumber &&
                    amount == other.amount &&
                    routingNumber == other.routingNumber &&
                    transferId == other.transferId &&
                    unstructuredRemittanceInformation == other.unstructuredRemittanceInformation &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    accountNumber,
                    amount,
                    routingNumber,
                    transferId,
                    unstructuredRemittanceInformation,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "RealTimePaymentsTransferAcknowledgement{accountNumber=$accountNumber, amount=$amount, routingNumber=$routingNumber, transferId=$transferId, unstructuredRemittanceInformation=$unstructuredRemittanceInformation, additionalProperties=$additionalProperties}"
        }

        /**
         * A Sample Funds object. This field will be present in the JSON response if and only if
         * `category` is equal to `sample_funds`. Sample funds for testing purposes.
         */
        class SampleFunds
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val originator: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

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

            /**
             * Where the sample funds came from.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun originator(): String = originator.getRequired("originator")

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

            @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 [SampleFunds].
                 *
                 * The following fields are required:
                 * ```java
                 * .originator()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

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

                @JvmSynthetic
                internal fun from(sampleFunds: SampleFunds) = apply {
                    originator = sampleFunds.originator
                    additionalProperties = sampleFunds.additionalProperties.toMutableMap()
                }

                /** Where the sample funds came from. */
                fun originator(originator: String) = originator(JsonField.of(originator))

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

                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 [SampleFunds].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .originator()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): SampleFunds =
                    SampleFunds(
                        checkRequired("originator", originator),
                        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(): SampleFunds = apply {
                if (validated) {
                    return@apply
                }

                originator()
                validated = true
            }

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

            /**
             * Returns 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 (originator.asKnown().isPresent) 1 else 0)

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

                return other is SampleFunds &&
                    originator == other.originator &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "SampleFunds{originator=$originator, additionalProperties=$additionalProperties}"
        }

        /**
         * A Swift Transfer Intention object. This field will be present in the JSON response if and
         * only if `category` is equal to `swift_transfer_intention`. A Swift Transfer initiated via
         * Increase.
         */
        class SwiftTransferIntention
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val transferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

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

            /**
             * The identifier of the Swift Transfer that led to 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 transferId(): String = transferId.getRequired("transfer_id")

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

            @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
                 * [SwiftTransferIntention].
                 *
                 * The following fields are required:
                 * ```java
                 * .transferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

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

                @JvmSynthetic
                internal fun from(swiftTransferIntention: SwiftTransferIntention) = apply {
                    transferId = swiftTransferIntention.transferId
                    additionalProperties =
                        swiftTransferIntention.additionalProperties.toMutableMap()
                }

                /** The identifier of the Swift Transfer that led to this Transaction. */
                fun transferId(transferId: String) = transferId(JsonField.of(transferId))

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

                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 [SwiftTransferIntention].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .transferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): SwiftTransferIntention =
                    SwiftTransferIntention(
                        checkRequired("transferId", transferId),
                        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(): SwiftTransferIntention = apply {
                if (validated) {
                    return@apply
                }

                transferId()
                validated = true
            }

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

            /**
             * Returns 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 (transferId.asKnown().isPresent) 1 else 0)

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

                return other is SwiftTransferIntention &&
                    transferId == other.transferId &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "SwiftTransferIntention{transferId=$transferId, additionalProperties=$additionalProperties}"
        }

        /**
         * A Swift Transfer Return object. This field will be present in the JSON response if and
         * only if `category` is equal to `swift_transfer_return`. A Swift Transfer Return is
         * created when a Swift Transfer is returned by the receiving bank.
         */
        class SwiftTransferReturn
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val transferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

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

            /**
             * The identifier of the Swift Transfer that led to 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 transferId(): String = transferId.getRequired("transfer_id")

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

            @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 [SwiftTransferReturn].
                 *
                 * The following fields are required:
                 * ```java
                 * .transferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

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

                @JvmSynthetic
                internal fun from(swiftTransferReturn: SwiftTransferReturn) = apply {
                    transferId = swiftTransferReturn.transferId
                    additionalProperties = swiftTransferReturn.additionalProperties.toMutableMap()
                }

                /** The identifier of the Swift Transfer that led to this Transaction. */
                fun transferId(transferId: String) = transferId(JsonField.of(transferId))

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

                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 [SwiftTransferReturn].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .transferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): SwiftTransferReturn =
                    SwiftTransferReturn(
                        checkRequired("transferId", transferId),
                        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(): SwiftTransferReturn = apply {
                if (validated) {
                    return@apply
                }

                transferId()
                validated = true
            }

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

            /**
             * Returns 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 (transferId.asKnown().isPresent) 1 else 0)

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

                return other is SwiftTransferReturn &&
                    transferId == other.transferId &&
                    additionalProperties == other.additionalProperties
            }

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

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "SwiftTransferReturn{transferId=$transferId, additionalProperties=$additionalProperties}"
        }

        /**
         * A Wire Transfer Intention object. This field will be present in the JSON response if and
         * only if `category` is equal to `wire_transfer_intention`. A Wire Transfer initiated via
         * Increase and sent to a different bank.
         */
        class WireTransferIntention
        @JsonCreator(mode = JsonCreator.Mode.DISABLED)
        private constructor(
            private val accountNumber: JsonField<String>,
            private val amount: JsonField<Long>,
            private val messageToRecipient: JsonField<String>,
            private val routingNumber: JsonField<String>,
            private val transferId: JsonField<String>,
            private val additionalProperties: MutableMap<String, JsonValue>,
        ) {

            @JsonCreator
            private constructor(
                @JsonProperty("account_number")
                @ExcludeMissing
                accountNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("amount") @ExcludeMissing amount: JsonField<Long> = JsonMissing.of(),
                @JsonProperty("message_to_recipient")
                @ExcludeMissing
                messageToRecipient: JsonField<String> = JsonMissing.of(),
                @JsonProperty("routing_number")
                @ExcludeMissing
                routingNumber: JsonField<String> = JsonMissing.of(),
                @JsonProperty("transfer_id")
                @ExcludeMissing
                transferId: JsonField<String> = JsonMissing.of(),
            ) : this(
                accountNumber,
                amount,
                messageToRecipient,
                routingNumber,
                transferId,
                mutableMapOf(),
            )

            /**
             * The destination account 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 accountNumber(): String = accountNumber.getRequired("account_number")

            /**
             * The transfer amount in USD 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 message that will show on the recipient's bank statement.
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun messageToRecipient(): String =
                messageToRecipient.getRequired("message_to_recipient")

            /**
             * The American Bankers' Association (ABA) Routing Transit Number (RTN).
             *
             * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
             *   unexpectedly missing or null (e.g. if the server responded with an unexpected
             *   value).
             */
            fun routingNumber(): String = routingNumber.getRequired("routing_number")

            /**
             * The identifier of the Wire Transfer that led to 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 transferId(): String = transferId.getRequired("transfer_id")

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

            /**
             * 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 [messageToRecipient].
             *
             * Unlike [messageToRecipient], this method doesn't throw if the JSON field has an
             * unexpected type.
             */
            @JsonProperty("message_to_recipient")
            @ExcludeMissing
            fun _messageToRecipient(): JsonField<String> = messageToRecipient

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

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

            @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
                 * [WireTransferIntention].
                 *
                 * The following fields are required:
                 * ```java
                 * .accountNumber()
                 * .amount()
                 * .messageToRecipient()
                 * .routingNumber()
                 * .transferId()
                 * ```
                 */
                @JvmStatic fun builder() = Builder()
            }

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

                private var accountNumber: JsonField<String>? = null
                private var amount: JsonField<Long>? = null
                private var messageToRecipient: JsonField<String>? = null
                private var routingNumber: JsonField<String>? = null
                private var transferId: JsonField<String>? = null
                private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

                @JvmSynthetic
                internal fun from(wireTransferIntention: WireTransferIntention) = apply {
                    accountNumber = wireTransferIntention.accountNumber
                    amount = wireTransferIntention.amount
                    messageToRecipient = wireTransferIntention.messageToRecipient
                    routingNumber = wireTransferIntention.routingNumber
                    transferId = wireTransferIntention.transferId
                    additionalProperties = wireTransferIntention.additionalProperties.toMutableMap()
                }

                /** The destination account number. */
                fun accountNumber(accountNumber: String) =
                    accountNumber(JsonField.of(accountNumber))

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

                /** The transfer amount in USD 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 message that will show on the recipient's bank statement. */
                fun messageToRecipient(messageToRecipient: String) =
                    messageToRecipient(JsonField.of(messageToRecipient))

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

                /** The American Bankers' Association (ABA) Routing Transit Number (RTN). */
                fun routingNumber(routingNumber: String) =
                    routingNumber(JsonField.of(routingNumber))

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

                /** The identifier of the Wire Transfer that led to this Transaction. */
                fun transferId(transferId: String) = transferId(JsonField.of(transferId))

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

                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 [WireTransferIntention].
                 *
                 * Further updates to this [Builder] will not mutate the returned instance.
                 *
                 * The following fields are required:
                 * ```java
                 * .accountNumber()
                 * .amount()
                 * .messageToRecipient()
                 * .routingNumber()
                 * .transferId()
                 * ```
                 *
                 * @throws IllegalStateException if any required field is unset.
                 */
                fun build(): WireTransferIntention =
                    WireTransferIntention(
                        checkRequired("accountNumber", accountNumber),
                        checkRequired("amount", amount),
                        checkRequired("messageToRecipient", messageToRecipient),
                        checkRequired("routingNumber", routingNumber),
                        checkRequired("transferId", transferId),
                        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(): WireTransferIntention = apply {
                if (validated) {
                    return@apply
                }

                accountNumber()
                amount()
                messageToRecipient()
                routingNumber()
                transferId()
                validated = true
            }

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

            /**
             * Returns 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 (accountNumber.asKnown().isPresent) 1 else 0) +
                    (if (amount.asKnown().isPresent) 1 else 0) +
                    (if (messageToRecipient.asKnown().isPresent) 1 else 0) +
                    (if (routingNumber.asKnown().isPresent) 1 else 0) +
                    (if (transferId.asKnown().isPresent) 1 else 0)

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

                return other is WireTransferIntention &&
                    accountNumber == other.accountNumber &&
                    amount == other.amount &&
                    messageToRecipient == other.messageToRecipient &&
                    routingNumber == other.routingNumber &&
                    transferId == other.transferId &&
                    additionalProperties == other.additionalProperties
            }

            private val hashCode: Int by lazy {
                Objects.hash(
                    accountNumber,
                    amount,
                    messageToRecipient,
                    routingNumber,
                    transferId,
                    additionalProperties,
                )
            }

            override fun hashCode(): Int = hashCode

            override fun toString() =
                "WireTransferIntention{accountNumber=$accountNumber, amount=$amount, messageToRecipient=$messageToRecipient, routingNumber=$routingNumber, transferId=$transferId, additionalProperties=$additionalProperties}"
        }

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

            return other is Source &&
                category == other.category &&
                accountRevenuePayment == other.accountRevenuePayment &&
                accountTransferIntention == other.accountTransferIntention &&
                achTransferIntention == other.achTransferIntention &&
                achTransferRejection == other.achTransferRejection &&
                achTransferReturn == other.achTransferReturn &&
                blockchainOfframpTransferSettlement == other.blockchainOfframpTransferSettlement &&
                blockchainOnrampTransferIntention == other.blockchainOnrampTransferIntention &&
                cardDisputeAcceptance == other.cardDisputeAcceptance &&
                cardDisputeFinancial == other.cardDisputeFinancial &&
                cardDisputeLoss == other.cardDisputeLoss &&
                cardFinancial == other.cardFinancial &&
                cardPushTransferAcceptance == other.cardPushTransferAcceptance &&
                cardRefund == other.cardRefund &&
                cardRevenuePayment == other.cardRevenuePayment &&
                cardSettlement == other.cardSettlement &&
                cashbackPayment == other.cashbackPayment &&
                checkDepositAcceptance == other.checkDepositAcceptance &&
                checkDepositReturn == other.checkDepositReturn &&
                checkTransferDeposit == other.checkTransferDeposit &&
                fednowTransferAcknowledgement == other.fednowTransferAcknowledgement &&
                feePayment == other.feePayment &&
                inboundAchTransfer == other.inboundAchTransfer &&
                inboundAchTransferReturnIntention == other.inboundAchTransferReturnIntention &&
                inboundCheckAdjustment == other.inboundCheckAdjustment &&
                inboundCheckDepositReturnIntention == other.inboundCheckDepositReturnIntention &&
                inboundFednowTransferConfirmation == other.inboundFednowTransferConfirmation &&
                inboundRealTimePaymentsTransferConfirmation ==
                    other.inboundRealTimePaymentsTransferConfirmation &&
                inboundWireReversal == other.inboundWireReversal &&
                inboundWireTransfer == other.inboundWireTransfer &&
                inboundWireTransferReversal == other.inboundWireTransferReversal &&
                interestPayment == other.interestPayment &&
                internalSource == other.internalSource &&
                this.other == other.other &&
                realTimePaymentsTransferAcknowledgement ==
                    other.realTimePaymentsTransferAcknowledgement &&
                sampleFunds == other.sampleFunds &&
                swiftTransferIntention == other.swiftTransferIntention &&
                swiftTransferReturn == other.swiftTransferReturn &&
                wireTransferIntention == other.wireTransferIntention &&
                additionalProperties == other.additionalProperties
        }

        private val hashCode: Int by lazy {
            Objects.hash(
                category,
                accountRevenuePayment,
                accountTransferIntention,
                achTransferIntention,
                achTransferRejection,
                achTransferReturn,
                blockchainOfframpTransferSettlement,
                blockchainOnrampTransferIntention,
                cardDisputeAcceptance,
                cardDisputeFinancial,
                cardDisputeLoss,
                cardFinancial,
                cardPushTransferAcceptance,
                cardRefund,
                cardRevenuePayment,
                cardSettlement,
                cashbackPayment,
                checkDepositAcceptance,
                checkDepositReturn,
                checkTransferDeposit,
                fednowTransferAcknowledgement,
                feePayment,
                inboundAchTransfer,
                inboundAchTransferReturnIntention,
                inboundCheckAdjustment,
                inboundCheckDepositReturnIntention,
                inboundFednowTransferConfirmation,
                inboundRealTimePaymentsTransferConfirmation,
                inboundWireReversal,
                inboundWireTransfer,
                inboundWireTransferReversal,
                interestPayment,
                internalSource,
                other,
                realTimePaymentsTransferAcknowledgement,
                sampleFunds,
                swiftTransferIntention,
                swiftTransferReturn,
                wireTransferIntention,
                additionalProperties,
            )
        }

        override fun hashCode(): Int = hashCode

        override fun toString() =
            "Source{category=$category, accountRevenuePayment=$accountRevenuePayment, accountTransferIntention=$accountTransferIntention, achTransferIntention=$achTransferIntention, achTransferRejection=$achTransferRejection, achTransferReturn=$achTransferReturn, blockchainOfframpTransferSettlement=$blockchainOfframpTransferSettlement, blockchainOnrampTransferIntention=$blockchainOnrampTransferIntention, cardDisputeAcceptance=$cardDisputeAcceptance, cardDisputeFinancial=$cardDisputeFinancial, cardDisputeLoss=$cardDisputeLoss, cardFinancial=$cardFinancial, cardPushTransferAcceptance=$cardPushTransferAcceptance, cardRefund=$cardRefund, cardRevenuePayment=$cardRevenuePayment, cardSettlement=$cardSettlement, cashbackPayment=$cashbackPayment, checkDepositAcceptance=$checkDepositAcceptance, checkDepositReturn=$checkDepositReturn, checkTransferDeposit=$checkTransferDeposit, fednowTransferAcknowledgement=$fednowTransferAcknowledgement, feePayment=$feePayment, inboundAchTransfer=$inboundAchTransfer, inboundAchTransferReturnIntention=$inboundAchTransferReturnIntention, inboundCheckAdjustment=$inboundCheckAdjustment, inboundCheckDepositReturnIntention=$inboundCheckDepositReturnIntention, inboundFednowTransferConfirmation=$inboundFednowTransferConfirmation, inboundRealTimePaymentsTransferConfirmation=$inboundRealTimePaymentsTransferConfirmation, inboundWireReversal=$inboundWireReversal, inboundWireTransfer=$inboundWireTransfer, inboundWireTransferReversal=$inboundWireTransferReversal, interestPayment=$interestPayment, internalSource=$internalSource, other=$other, realTimePaymentsTransferAcknowledgement=$realTimePaymentsTransferAcknowledgement, sampleFunds=$sampleFunds, swiftTransferIntention=$swiftTransferIntention, swiftTransferReturn=$swiftTransferReturn, wireTransferIntention=$wireTransferIntention, additionalProperties=$additionalProperties}"
    }

    /**
     * A constant representing the object's type. For this resource it will always be `transaction`.
     */
    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 TRANSACTION = of("transaction")

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

        /** An enum containing [Type]'s known values. */
        enum class Known {
            TRANSACTION
        }

        /**
         * 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 {
            TRANSACTION,
            /** 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) {
                TRANSACTION -> Value.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) {
                TRANSACTION -> Known.TRANSACTION
                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 Transaction &&
            id == other.id &&
            accountId == other.accountId &&
            amount == other.amount &&
            createdAt == other.createdAt &&
            currency == other.currency &&
            description == other.description &&
            routeId == other.routeId &&
            routeType == other.routeType &&
            source == other.source &&
            type == other.type &&
            additionalProperties == other.additionalProperties
    }

    private val hashCode: Int by lazy {
        Objects.hash(
            id,
            accountId,
            amount,
            createdAt,
            currency,
            description,
            routeId,
            routeType,
            source,
            type,
            additionalProperties,
        )
    }

    override fun hashCode(): Int = hashCode

    override fun toString() =
        "Transaction{id=$id, accountId=$accountId, amount=$amount, createdAt=$createdAt, currency=$currency, description=$description, routeId=$routeId, routeType=$routeType, source=$source, type=$type, additionalProperties=$additionalProperties}"
}
